coding the DFF

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

coding the DFF

Eric T.
Would it be possible to code the DFF in project 3, instead of use it as a built-in chip? I'm assuming this would require simulator changes, since when I tried to code it, I got "This chip has a circle in its parts connections." Also, can it be made so the chip can tap into the clock and use it as an input?
Reply | Threaded
Open this post in threaded view
|

Re: coding the DFF

Noam
The answer is "no" and "no".  

It was a pedagogic decision to treat a DFF as atomic rather than build it from NAND gates as is commonly done.  The reasoning is that allowing loops in combinatorial logic gates requires deviating from their simple logical abstraction, complicating matters conceptually; similarly the temporal implications that this would allow would considerably complicate the simple abstraction of discrete time in sequential chips.  

The simulator follows this decision and does not allow loops in combinatorial circuits (another "compilation-like" benefit of this decision).  The whole internal logic of the simulator uses this restriction in an essential way, and is different (and more efficient) than usual hardware simulators that allow combinatorial loops.  Similarly time is handled as a primitive by the simulator and there is no "clock" pin accessible from HDL.  
Reply | Threaded
Open this post in threaded view
|

Re: coding the DFF

Eric T.
Ok, thanks.
Reply | Threaded
Open this post in threaded view
|

Re: coding the DFF

Jorge
In reply to this post by Noam
Dear Mr. Noam, I am sure you had good reasons for implementing the simulator this way, however, for someone that is struggling to understand how these bits and pieces work together, your answer is somewhat obscure, I already understand that it can't be implemented on the simulator however I can't discern your answer from "You shall not attempt to simulate the DFF on the simulator", in other words, I realize the answer is "No" and that there are good reasons for that but I still don't understand why at all. Please, provide us with a more simplified explanation of why.
Reply | Threaded
Open this post in threaded view
|

Re: coding the DFF

milythael
Implementing DFF with Nand gates requires a feedback loop, meaning the output of a gate affects the input of that same gate.  This kind of interaction works automatically in reality but it is a challenge to implement in code.  By limiting DFFs to a primitive it is possible to greatly simplify the implementation of the hardware simulator.  Additionally, disallowing feedback loops in combinatorial circuits (Chapters 1 & 2) gives a side benefit of identifying a class of errors students make in their designs more readily.  It also greatly supports the key point of the text that computers are layers of abstraction built upon each other.