{"id":18781896,"url":"https://github.com/takenobu-hs/processor-creative-kit","last_synced_at":"2025-04-13T12:07:53.661Z","repository":{"id":21496724,"uuid":"24815645","full_name":"takenobu-hs/processor-creative-kit","owner":"takenobu-hs","description":"haskell prrocessor-creative-kit","archived":false,"fork":false,"pushed_at":"2015-01-31T00:12:48.000Z","size":334,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T03:11:22.330Z","etag":null,"topics":["assembly","cpu","haskell"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takenobu-hs.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-05T12:54:39.000Z","updated_at":"2020-01-07T13:23:39.000Z","dependencies_parsed_at":"2022-08-20T10:11:10.584Z","dependency_job_id":null,"html_url":"https://github.com/takenobu-hs/processor-creative-kit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takenobu-hs%2Fprocessor-creative-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takenobu-hs%2Fprocessor-creative-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takenobu-hs%2Fprocessor-creative-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takenobu-hs%2Fprocessor-creative-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takenobu-hs","download_url":"https://codeload.github.com/takenobu-hs/processor-creative-kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248553701,"owners_count":21123501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","cpu","haskell"],"created_at":"2024-11-07T20:34:08.751Z","updated_at":"2025-04-13T12:07:53.639Z","avatar_url":"https://github.com/takenobu-hs.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Processor-creative-kit\n======================\n\nThis is a [haskell package][1] for playing processors.\n\nYou can create your processors with your own instruction set and cpu simulators and development tools.\n\nenjoy! :smiley:\n\n\nSummary\n-------\n\nFeature\n  - easy try, easy modify\n  - a purely functional CPU core (without IO)  (you can embed it anywhere)\n  - including a very simple prototype assembler\n  - including a very simple prototype debugger\n  - including a very simple prototype profiler\n\nAcknowledgements\n  - I was inspired from these packages:\n    [HARM][2],\n    [powerpc][3],\n    [ministg][4],\n    [hython][5].\n  - and many processors, many tools. Thank you.\n\n\n\nQuick tour\n----------\n\n### (i) install\n\n  To expand the source code in your working directory:\n\n    $ cd YOUR_WORK_DIRECTORY\n    $ cabal unpack processor-creative-kit\n\n  or\n\n    $ tar xvzf processor-creative-kit.tar.gz\n\n  Then, install the dependent packages:\n\n    $ cabal install --only-dependencies\n\n\n\n### (ii) run examples\n\n**run**\n\n    $ runhaskell examples/run.hs examples/test0.asm\n\n  result:\n\n    pc : 3\n    gr : [0,100,200,300,0,0,0,0]\n    fl : [False,False]\n    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])]\n\n\n**tracing run**\n\n    $ runhaskell examples/trace.hs examples/test0.asm\n\n  result:\n\n    TrcInst:        pc : 0x0        MOVI R1 100\n    \n    TrcInst:        pc : 0x1        MOVI R2 200\n    \n    TrcInst:        pc : 0x2        ADD R3 R1 R2\n    \n    TrcInst:        pc : 0x3        HALT\n\n\n**profiling run**\n\n    $ runhaskell examples/prof.hs examples/test0.asm\n\n  result:\n\n    instruction profile:\n    \n      MOVI  2\n      ADD   1\n      HALT  1\n    \n      total 4\n    \n    \n    Call target profile:\n    \n      address       count\n    (snip)\n\n\n**interactive debugger**\n\n    $ runhaskell examples/idb.hs examples/test0.asm\n\n  result:\n\n    For help, type \"help\".\n    \n    (idb) run\n    TrcInst:        pc : 0x0        MOVI R1 100\n    \n    TrcInst:        pc : 0x1        MOVI R2 200\n    \n    TrcInst:        pc : 0x2        ADD R3 R1 R2\n    \n    TrcInst:        pc : 0x3        HALT\n    \n    (idb) info reg\n    pc : 3\n    gr : [0,100,200,300,0,0,0,0]\n    fl : [False,False]\n    \n    (idb) x/8 0\n    0x00000000: 0x00000000 0x00000000 0x00000000 0x00000000\n    0x00000004: 0x00000000 0x00000000 0x00000000 0x00000000\n    \n    (idb) b 1\n    Num  Enb What\n    1    y   PC == 1  (PC == 0x1)\n    \n    (idb) run\n    TrcInst:        pc : 0x0        MOVI R1 100\n    \n    (idb) s\n    TrcInst:        pc : 0x1        MOVI R2 200\n    \n    (idb) s\n    TrcInst:        pc : 0x2        ADD R3 R1 R2\n    \n    (idb) help\n    List of commands:\n    \n    q       -- Exit debugger\n    help    -- Print list of commands\n    run     -- Start debugged program\n    s       -- Step program\n    c       -- Continue program being debugged\n    x       -- Examin memory: x(/COUNT) ADDRESS\n    info reg        -- List of registers\n    disas   -- Disassemble: disassemble (ADDRESS)\n    info b  -- Status of breakpoints\n    disable -- Disable breakpoint: disable NUMBER\n    enable  -- Enable breakpoint: enable NUMBER\n    delete  -- Delete breakpoint: delete NUMBER\n    b       -- Set breakpoint: b ADDRESS\n    watch   -- Set a watchpoint. example:\n                 data memory -- watch *0x80 != 10\n                 pc          -- watch pc \u003e 3\n                 register    -- watch r7 == 3\n    p       -- Print memory value: p *ADDRESS\n    p       -- Set memory value: p *ADDRESS = VALUE\n    \n    (idb) q\n\n\n\n### (iii) add instructions\n\n**add an negative instruction (`neg r0,r1`)**\n\n  insert following lines:\n\n  [Language/Pck/Cpu/Instruction.hs] ... internal representation on the cpu\n  ~~~haskell\n            | NEG   GReg GReg\n  ~~~\n\n  [Language/Pck/Cpu/Execution.hs] ... internal behavior on the cpu\n  ~~~haskell\n  evalStep (NEG   ra rb)    = uniopInst (*(-1)) ra rb\n  ~~~\n\n  [Language/Pck/Tool/Assembler.hs] ... assembler format\n  ~~~haskell\n           \u003c|\u003e inst2 NEG  \"neg\" greg greg\n  ~~~\n\n\n\nMore documents\n--------------\n  - [How to use the API (docs/1_HowToUseAPI.md)] [6]\n  - [How to create your processors (docs/2_HowToCreate.md)] [7]\n  - [hackage processor-creative-kit] [1]\n\n\n\nNote\n----\n\nDefault processor architecture\n  - Harvard architecture. (instruction and data memories are splitted)\n  - fixed length instruction (word length)\n  - word addressing (not byte addressing)\n  - ideal immediate length (an immediate can be set by one instruction)\n  - no FPU, MMU, cache, privilege level, interruption, I/O, and any\n\n\nLimitation\n  - using the slow container(Data.Array) for simple implementation.\n\n\n[1]: https://hackage.haskell.org/package/processor-creative-kit\n[2]: https://hackage.haskell.org/package/HARM\n[3]: https://hackage.haskell.org/package/powerpc\n[4]: https://hackage.haskell.org/package/ministg\n[5]: https://github.com/mattgreen/hython\n[6]: https://github.com/takenobu-hs/processor-creative-kit/blob/master/docs/1_HowToUseAPI.md\n[7]: https://github.com/takenobu-hs/processor-creative-kit/blob/master/docs/2_HowToCreate.md\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakenobu-hs%2Fprocessor-creative-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakenobu-hs%2Fprocessor-creative-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakenobu-hs%2Fprocessor-creative-kit/lists"}