Here's the data file if you want to check it out :) http://marcansoft.com/uploads/piccpu.circ And here's the microcode "source code". This gets turned into a ROM mapping the top 8 instruction bits to 16 control lines by a small Python script. Only 13 control lines are used so far. http://marcansoft.com/uploads/pic_cpu_ucode.txt The hex microcodecode ROM data is already in the .circ file above. The sample program ROM just runs a basic loop, using decfsz. Note that I've basically tacked on two bits into the middle of the standard 14-bit instruction word. For instructions that take an f-reg, one bit is used as an extra addressing bit (this is part of the lower word, not mapped into the microcode). For instructions that take an 8-bit literal, this is just a don't care (though it's inserted at a different spot in the instruction word - here, the full lower word is the literal, and the upper word has two don't care bits). The other bit is unused in both of these cases. With instructions that load the PC, these bits are used to provide 12-bit immediate PC addressing. The opcodes are otherwise the same. This should make it fairly trivial to write a converter to change a PIC hex file into this variation. I've found that 181 ALUs are very flexible. Though they're pretty cryptic to work with, they can implement almost every PIC ALU instruction with no extra work. Only rrf needs an external mux to deal with the rotation (rlf is just f+f, which the 181 ALU can do). A 3-to-8 decoder hooked up to the ALU input takes care of the b*f/btfs* instructions as well. I haven't done swapf, since it would involve another output MUX like rrf, and it isn't really used all that often. Hope you find some use for it! I've found watching a "PIC" run through code and seeing every signal to be pretty entertaining and educational, if nothing else. I've showed it to other non-engineers, and they do get a quick idea of the linear, step-based nature of sequential logic systems like CPUs, just by watching the lines flicker on and off as the PC steps through the code. -- Hector Martin (hector@marcansoft.com) Public Key: http://www.marcansoft.com/marcan.asc -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist