A concept for a small RPN processor with interesting features
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
emulation.zipEarly alpha version of CPU7 emulation code written in C (probably buggy)x-zip-compressed - 18.05 kB - 12/25/2016 at 12:23 |
|
|
CPU7.pdfCPU7 descriptionAdobe Portable Document Format - 410.88 kB - 03/26/2016 at 11:38 |
|
|
Although natively working with 16-bit words (14-bit pairs of instructions or data), CPU7 is also supposed to handle "raw" unformatted data in 8-bit, 16-bit, or 32-bit format. As an example that could be a hardware register, video memory, or anything which is not part of CPU7.
As a small coding exercise to test the flavour of the CPU7 assembler, here is the well known "bubble sort" of an area of unformatted bytes.
'! usage: addr len bubblesort8
:bubblesort8
dup 1 > if `! check if the array is more than one element
enter
1 over + `! calculate end=addr+len; stack: beg, end
1 swap dup `! stack: end, beg, addr
repeat
dup rd8 `! stack: end, beg, addr, [addr]
1 over ++ rd8 `! stack: end, beg, addr, [addr], [addr+1]
< if `! stack: end, beg, addr
++ `! addr=addr+1
else
dup rd8 `! stack: end, beg, addr, [addr]
1 over ++ rd8 `! stack: end, beg, addr, [addr], [addr+1]
2 over wr8 `! stack: end, beg, addr, [addr]
1 over ++ wr8 `! stack: end, beg, addr
drop dup `! addr=beg; stack: end, beg, addr
endif
dup 3 over < until
leave `! clean up the data stack
endif
drop drop `! remove the input parameters from the data stack
;
Create an account to leave a comment. Already have an account? Log In.
Nice project. The choice on the 7 bit is interesting. I have created a homebrew CPU also using 7 bits of data, although mine is more minimalist and designed to support functional programming.
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More
Thank you very much for this interesting project. I've implemented most instructions of cpu7 in Verilog https://github.com/wil-low/projf-explore/tree/main/cpu/cpu7 . It was fun!