CPU implementation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

CPU implementation

xedover
wow, this one has been the toughest one for me so far... I've been staring at the schematic for a week now. I think I have most of the pins figured out, but the Jump logic is exploding my brain.

I thought I came up with something that should work, but I'm getting "Comparison failure at line 3" -- because my PC counter is not incrementing.

I'm not sure how to ask for help without posting my code or schematics for review.
Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

cadet1620
Administrator
The first thing to realize about the PC is that its default operations is to increment every clock cycle. Jumping and Reset are special cases.  Also, remember the priority on the PC's control signals: reset overrides load overrides increment.

There are several control signals that are only active only during a-instructions or only during c-instructions so it is handy to create 'aInst' and 'cInst' signals that can be used to enable those signals.

For example, think about when the CPU should jump. It only jumps when it is executing a c-instruction and a jump bit in the instruction and its corresponding ALU status bit are both set.  (Hint: make an aluPos status signal from aluZr and aluNg.)

If you want to, you can email me your CPU and I'll send you back comments. Be sure to include any helper chips you may have made for its implementation.

--Mark
 

Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

xedover
thanks, I've emailed my code to you.
Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

xedover
In reply to this post by cadet1620
oh my goodness, I totally mislabled and missed connecting my pc output, and also totally forgot my writeM output.

you're correct, fixing those takes me to my screwy jump logic now... Now I feel better about what I've done so far, so I'll take a closer look at my jump logic and see if I can redo it. I've probably misread my truth tables and boolean expressions.

thanks so much for reviewing my code. and thanks for the program flow animation tip too.
Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

xedover
yay !! I did it. It passed all the testcases. Thanks so much for your help.

Omitting the output pins was really tripping me up. There were so many connections to make, is was a bit confusing and overwhelming.

Thanks for the tip about me trying to AND together my jump logic. Replaced that with a Mux (once I figured out what to base the select on), and a few more tweaks and changes -- replacing a NOR with a NAND and an OR with an AND in various places, etc. (those basic truth tables get all mixed up in my head). I probably still have some extra unneeded AND's that are probably duplicating what my Mux is doing -- but it passes, so I think its close enough for now.

Its a good thing I was way ahead of schedule on the first 4 week's projects, because this one took nearly as long (yet, I'm still ahead of schedule overall).