CPU implementation

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

CPU implementation

nandona

So I've been sitting for like 3 days on this and I don't really have much. My brain is just stuck on how I distinguish between a c instruction and an a instruction and when the calculation is happening and when it is not. :q

Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

ivant
Generally, in hardware when you need to choose between two things you'll compute both and use the output that you need. You have a gate (or rather a group of related gates) which can do the choosing part.
Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

nandona
Ok. So my way of thinking was to take the op code, pass it to the not gate abd then with a mux to pass the instruction to the A register. After that pass the same negated op code to the load input so when an a instruction is passed it would get it would set its value to the new value and then for this cycle I dont really care what happens. As for a c instruction the a wont be set and connected the first a control bit to the second mux in with the a output and in(m) and then all other c to the alu. 
What I dont know how ia how to set the a value if the of the dest is A
Reply | Threaded
Open this post in threaded view
|

Re: CPU implementation

ivant
It's a bit hard to follow what you wrote. Why would you pass the op code to a not gate?

The CPU has two main modes: operate on A instruction or on C instruction. How can you distinguish this? This is part of the control subsystem of the CPU. Most of it is already shown on Figure 5.9, but there are some details missing. You can start by implementing them.

For example, there's control signal going to register A, which tells it if it should remember or ignore its input. What are the conditions for this?

Hint: you can leave the PC controls for last. They are important to implement the jump behavior, but are a bit "hairy" but also quite isolated. I found it easier to think of them last.