PC Counter

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

PC Counter

dmoeller
I need somone to explain this chip in laymans terms please, I dont understand what it does or how to start building it.
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

ybakos
The PC is a Program Counter. It is a chip that will:

- emit an increasing number. eg. 0, 1, 2, 3, 4...
- allow you to reset the counter, making it start over at 0.. then 1, 2, 3, 4...
- allow you to tell it to emit a particular number ("Hey PC, emit the number 420.")

Follow up with specific questions.
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

dmoeller
so i have my muxes set up, and my INC16, but i get a comparison error at line 5, which is when time is at 2. Im not sure which part of my code is wrong
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

cadet1620
Administrator
| time |   in   |reset|load | inc |  out   |
| 0+   |      0 |  0  |  0  |  0  |      0 |
| 1    |      0 |  0  |  0  |  0  |      0 |
| 1+   |      0 |  0  |  0  |  1  |      0 |
| 2    |      0 |  0  |  0  |  1  |      1 |
| 2+   | -32123 |  0  |  0  |  1  |      1 |
Load the test script, select View: Output.
Single step the test until you get to time 1+.
Look at the internal pins.

Because this is an increment operation, the input to the Register should be 1 and the Register's load should be 1.

If this is not the case, look at your Mux16 outputs and figure out what went wrong.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

dmoeller
I ran it from an isolated folder with just PC.hdl, PC.tst, and PC.cmp and it worked with no problems.
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

nomad
In reply to this post by cadet1620
cadet1620 wrote
Because this is an increment operation, the input to the Register should be 1 and the Register's load should be 1.
Can you elaborate on why the load bit should be 1 if we're incrementing? If I've understood everything so far correctly, I am under the impression that load should only be 1 when we want to load from "in". Your previous replies to many questions on this forum have helped me immensely up to this point; I really appreciate your ability to clarify without handing out the answers, as that "A-HA!" moment is truly the essence of this learning experience.

Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: PC Counter

nomad
Just an update/FYI I actually did figure this out after reading another comment of yours! My logic was flawed in the assumption that we only wanted the register's load bit to be 1 when we load from "in". I hope this isn't too much of a hint to others looking to solve this the "simple way" but we actually want the register's load bit to be true any time there is an operation requiring a state change in the register. From there it was a simple matter of combinational logic to construct what constitutes a state change - and voila!

I read many other posts with people who came up with all kinds of interesting and (sometimes overly) complex solutions. Glad to report that it is in fact possible to take the straightforward approach with this one!