Breaking News
Blog

Instruction set for a 4-bit HRRG Steampunk Computer

NO RATINGS
View Comments: Newest First | Oldest First | Threaded View
Page 1 / 2   >   >>
KarlS
User Rank
Rookie
re: Instruction set for a 4-bit HRRG Steampunk Computer
KarlS   4/20/2011 1:15:18 PM
NO RATINGS
You are right ... rotate then mask off bits for left shift, etc.

Max The Magnificent
User Rank
Blogger
re: Instruction set for a 4-bit HRRG Steampunk Computer
Max The Magnificent   4/19/2011 4:52:12 PM
NO RATINGS
Ah, but is it better to do left / right sifts or left / right rotates :-) we've been noodling furiously on this -- I will reveal all in my "How To" article tomorrow -- Max

KarlS
User Rank
Rookie
re: Instruction set for a 4-bit HRRG Steampunk Computer
KarlS   4/19/2011 3:48:25 PM
NO RATINGS
To really get down to basics: And Or Left shift by 1 Right Shift by 1 Invert/Complement Load Store Jump on true/false Call Return Then you can add the hard way And Or And (Or with ~And) for Xor Left Shift the And Repeat the above to propagate the Carries for a Ripple Carry Adder Then when you get tired of hand coding the Least Instruction Set Computer (LISC) you will appreciate Subroutines and figure a way to Call the Add subroutine with parameters. The Jump needs some work, but it would use flags like the old mainframes. Do a compare to get Gtr and Less. Conditional Jump on False that tests Gtr and Less for false would jump on Equal and Jump on True would jump if not equal. Any logic function can be done with enough And, Or and Inverts .. why you can even build a computer.

clematis
User Rank
Rookie
re: Instruction set for a 4-bit HRRG Steampunk Computer
clematis   4/17/2011 2:15:45 AM
NO RATINGS
When your 4-bit processor is all done and debugged, why don't you send it over to Ken Chapman at Xilinx? He has already created a VHDL design of an 8-bit processor called the "Picoblaze". If you haven't seen/used the Picoblaze you should check it out - it's very cool. Perhaps your 4-bit design could become an even simpler "Femtoblaze".

Max The Magnificent
User Rank
Blogger
re: Instruction set for a 4-bit HRRG Steampunk Computer
Max The Magnificent   4/16/2011 8:44:20 PM
NO RATINGS
This is another thing Joe and I are bouncing around. On the one hand we could make the CPU very minimalist and then use more instructions ... but this might not be so much fun (and not so intuitive) for beginners. Or we can have a more sophisticated CPU that supports more interesting instructions. Watch this space...

Max The Magnificent
User Rank
Blogger
re: Instruction set for a 4-bit HRRG Steampunk Computer
Max The Magnificent   4/16/2011 8:42:22 PM
NO RATINGS
I started on the basis of just having an accumulator -- also not having an interrupt structure or a stack -- but Joe says that if this is supposed to be educational then we should have a primitive interrupt structure and a stack. I think you'll be surprised with what we've come up with ... more soon -- Max

Max The Magnificent
User Rank
Blogger
re: Instruction set for a 4-bit HRRG Steampunk Computer
Max The Magnificent   4/16/2011 8:40:25 PM
NO RATINGS
I agree -- XOR is just too useful. One criteria for me is how many times you use an instruction -- I use XOR a lot. Joe says we don't need a CMP (compare) instruction, but I'm fighting for that one also :-)

Max The Magnificent
User Rank
Blogger
re: Instruction set for a 4-bit HRRG Steampunk Computer
Max The Magnificent   4/16/2011 8:38:35 PM
NO RATINGS
The fun thing is to set limitations and then work around them -- if we had 8-bit opcodes we might just as well make an 8-bit machine...

pmartel
User Rank
Rookie
re: Instruction set for a 4-bit HRRG Steampunk Computer
pmartel   4/16/2011 6:24:10 PM
NO RATINGS
You can replace AND, OR and NOT with NAND (AND followed by NOT)or NOR (OR followed by NOT). For instance, M0 AND M1 is LOAD A, M0 NAND A, M1 LOAD M2, A NAND A, M2 ; A has M0 AND M1 M0 XOR M1 is LOAD A, M0 NAND A, M0 LOAD M2, A LOAD A, M1 NAND A, M1 NAND A, M2 ;A now has M0 OR M1 LOAD M2, A LOAD A, M0 NAND A, M1 NAND A, M2 LOAD M2, A NAND A, M2 ; A has M0 XOR M1 Basically you can reduce the number of opcodes needed if you are willing to perform more operations. If you want to really have a minimal set of arithmetic/logic operations, you can build ADD up out of XOR (and AND) and so do all the arithmetic and logic ops with just NAND.

DPWARDEN
User Rank
Rookie
re: Instruction set for a 4-bit HRRG Steampunk Computer
DPWARDEN   4/16/2011 1:29:46 AM
NO RATINGS
Good mental exercise. I've never thought about 16 instructions--I would assume only 1 register (the accumulator) and two flags, carry and zero. For load/store, I think you would need: LOAD A,(addr) (load from memory) LOAD (addr),A and (store to memory) LOAD A, immediate. (load constant) For math, I would suppose: CC (clear carry), ADDC A,(addr), (add w/carry) SUBC (addr), (subtract w/borrow) COM A (1's complement), OR A, (addr), AND A, (addr) Shifts/rotates could be done with ROTL A and ROTR A; (CC could make these shifts.) Jumps need JUMP NC, (addr) and JUMP NZ, (addr); ...unconditional jumps can be handled by CC inst. I would also lobby for: CALL (addr) and RET. That's 15 instructions. INC and DEC can be handled by storing 1 in memory and performing ADDC or SUBC.

Page 1 / 2   >   >>
Flash Poll
Radio
LATEST ARCHIVED BROADCAST
EE Times editor Junko Yoshida grills two executives --Rick Walker, senior product marketing manager for IoT and home automation for CSR, and Jim Reich, CTO and co-founder at Palatehome.
Like Us on Facebook

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
EE Times on Twitter
EE Times Twitter Feed