processor-creative-kit: a creation kit for instruction sets and cpu simulators and development tools

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

You can create your processors with your own instruction set and cpu simulator and development tools.

Feature:


[Skip to Readme]

Properties

Versions 0.1.0.1, 0.1.0.1
Change log changelog.md
Dependencies array, attoparsec (>=0.10), base (>=4 && <5), bytestring (>=0.10), containers, deepseq (>=1.3), mtl [details]
License BSD-3-Clause
Copyright Takenobu Tani
Author Takenobu Tani
Maintainer takenobu.hs@gmail.com
Category Language, Hardware, Embedded, System
Home page https://github.com/takenobu-hs/processor-creative-kit
Source repo head: git clone https://github.com/takenobu-hs/processor-creative-kit.git
Uploaded by takenobut at 2015-01-31T00:08:31Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for processor-creative-kit-0.1.0.1

[back to package description]

Processor-creative-kit

This is a haskell package for playing processors.

You can create your processors with your own instruction set and cpu simulators and development tools.

enjoy! 😃

Summary

Feature

Acknowledgements

Quick tour

(i) install

To expand the source code in your working directory:

$ cd YOUR_WORK_DIRECTORY
$ cabal unpack processor-creative-kit

or

$ tar xvzf processor-creative-kit.tar.gz

Then, install the dependent packages:

$ cabal install --only-dependencies

(ii) run examples

run

$ runhaskell examples/run.hs examples/test0.asm

result:

pc : 3
gr : [0,100,200,300,0,0,0,0]
fl : [False,False]
dm : [(0,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])]

tracing run

$ runhaskell examples/trace.hs examples/test0.asm

result:

TrcInst:        pc : 0x0        MOVI R1 100

TrcInst:        pc : 0x1        MOVI R2 200

TrcInst:        pc : 0x2        ADD R3 R1 R2

TrcInst:        pc : 0x3        HALT

profiling run

$ runhaskell examples/prof.hs examples/test0.asm

result:

instruction profile:

  MOVI  2
  ADD   1
  HALT  1

  total 4


Call target profile:

  address       count
(snip)

interactive debugger

$ runhaskell examples/idb.hs examples/test0.asm

result:

For help, type "help".

(idb) run
TrcInst:        pc : 0x0        MOVI R1 100

TrcInst:        pc : 0x1        MOVI R2 200

TrcInst:        pc : 0x2        ADD R3 R1 R2

TrcInst:        pc : 0x3        HALT

(idb) info reg
pc : 3
gr : [0,100,200,300,0,0,0,0]
fl : [False,False]

(idb) x/8 0
0x00000000: 0x00000000 0x00000000 0x00000000 0x00000000
0x00000004: 0x00000000 0x00000000 0x00000000 0x00000000

(idb) b 1
Num  Enb What
1    y   PC == 1  (PC == 0x1)

(idb) run
TrcInst:        pc : 0x0        MOVI R1 100

(idb) s
TrcInst:        pc : 0x1        MOVI R2 200

(idb) s
TrcInst:        pc : 0x2        ADD R3 R1 R2

(idb) help
List of commands:

q       -- Exit debugger
help    -- Print list of commands
run     -- Start debugged program
s       -- Step program
c       -- Continue program being debugged
x       -- Examin memory: x(/COUNT) ADDRESS
info reg        -- List of registers
disas   -- Disassemble: disassemble (ADDRESS)
info b  -- Status of breakpoints
disable -- Disable breakpoint: disable NUMBER
enable  -- Enable breakpoint: enable NUMBER
delete  -- Delete breakpoint: delete NUMBER
b       -- Set breakpoint: b ADDRESS
watch   -- Set a watchpoint. example:
             data memory -- watch *0x80 != 10
             pc          -- watch pc > 3
             register    -- watch r7 == 3
p       -- Print memory value: p *ADDRESS
p       -- Set memory value: p *ADDRESS = VALUE

(idb) q

(iii) add instructions

add an negative instruction (neg r0,r1)

insert following lines:

[Language/Pck/Cpu/Instruction.hs] ... internal representation on the cpu

          | NEG   GReg GReg

[Language/Pck/Cpu/Execution.hs] ... internal behavior on the cpu

evalStep (NEG   ra rb)    = uniopInst (*(-1)) ra rb

[Language/Pck/Tool/Assembler.hs] ... assembler format

         <|> inst2 NEG  "neg" greg greg

More documents

Note

Default processor architecture

Limitation