DOC PREVIEW
U of I CS 231 - Lecture

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

October 13, 2003 Latches 1Latches• The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we’ve already seen.• Our schedule will be very similar to before: – We first show how primitive memory units are built.– Then we talk about analysis and design of sequential circuits.– We also see common sequential devices like registers and counters.• In the final third of the semester, we add memory to our ALU to make a complete processor!• But remember that sequential circuits are used for things other than processorsOctober 13, 2003 Latches 2Combinational circuits• So far we’ve just worked with combinational circuits, where applying the same inputs always produces the same outputs.• This corresponds to a mathematical function, where every input has a single, unique output.• In programming terminology, combinational circuits are similar to “functional programs” that do not contain variables and assignments.CombinationalcircuitInputs OutputsOctober 13, 2003 Latches 3Sequential circuits• In contrast, the outputs of a sequential circuit depend on not only the inputs, but also the state, or the current contents of some memory.• This makes things more difficult to understand, since the same inputs can yield different outputs, depending on what’s stored in memory.• The memory contents can also change as the circuit runs.• We’ll some need new techniques for analyzing and designing sequential circuits.CombinationalcircuitInputsMemoryOutputsOctober 13, 2003 Latches 4Examples of sequential devices• Many real-life devices are sequential in nature:– Combination locks open if you enter numbers in the right order.– Elevators move up or down and open or close depending on the buttons that are pressed on different floors and in the elevatoritself.– Traffic lights may switch from red to green depending on whetheror not a car is waiting at the intersection.• Most importantly for us, computers are sequential! For example, key presses and mouse clicks mean different things depending on which program is running and the state of that program.October 13, 2003 Latches 5What exactly is memory?• A memory should have at least three properties.1. It should be able to hold a value.2. You should be able to read the value that was saved.3. You should be able to change the value that’s saved.• We’ll start with the simplest case, a one-bit memory.1. It should be able to hold a single bit, 0 or 1.2. You should be able to read the bit that was saved.3. You should be able to change the value. Since there’s only a single bit, there are only two choices:– Set the bit to 1– Reset, or clear, the bit to 0.October 13, 2003 Latches 6The basic idea of storage• How can a circuit “remember” anything, when it’s just a bunch of gates that produce outputs according to the inputs?• The basic idea is to make a loop, so the circuit outputs are also inputs.• Here is one initial attempt, shown with two equivalent layouts:• Does this satisfy the properties of memory?– These circuits “remember” Q, because its value never changes. (Similarly, Q’ never changes either.)– We can also “read” Q, by attaching a probe or another circuit.– But we can’t change Q! There are no external inputs here, so we can’t control whether Q=1 or Q=0.October 13, 2003 Latches 7A really confusing circuit• Let’s use NOR gates instead of inverters. The SR latch below has two inputs S and R, which will let us control the outputs Q and Q’.• Here Q and Q’ feed back into the circuit. They’re not only outputs, they’re also inputs!• To figure out how Q and Q’ change, we have to look at not only the inputs S and R, but also the current values of Q and Q’:Qnext= (R + Q’current)’Q’next= (S + Qcurrent)’• Let’s see how different input values for S and R affect this thing.October 13, 2003 Latches 8Storing a value: SR = 00• What if S = 0 and R = 0?• The equations on the right reduce to:Qnext= (0 + Q’current)’ = QcurrentQ’next= (0 + Qcurrent)’ = Q’current• So when SR = 00, then Qnext= Qcurrent. Whatever value Q has, it keeps.• This is exactly what we need to store values in the latch.Qnext= (R + Q’current)’Q’next= (S + Qcurrent)’October 13, 2003 Latches 9Setting the latch: SR = 10• What if S = 1 and R = 0?• Since S = 1, Q’nextis 0, regardless of Qcurrent:Q’next= (1 + Qcurrent)’ = 0• Then, this new value of Q’ goes into the top NOR gate, along with R = 0.Qnext= (0 + 0)’ = 1• So when SR = 10, then Q’next= 0 and Qnext= 1.• This is how you set the latch to 1. The S input stands for “set.”• Notice that it can take up to two steps (two gate delays) from the time S becomes 1 to the time Qnextbecomes 1. • But once Qnextbecomes 1, the outputs will stop changing. This is a stable state.Qnext= (R + Q’current)’Q’next= (S + Qcurrent)’October 13, 2003 Latches 10Qnext= (R + Q’current)’Q’next= (S + Qcurrent)’Latch delays• Timing diagrams are especially useful in understanding how sequential circuits work.• Here is a diagram which shows an example of how our latch outputs change with inputs SR=10.0. Suppose that initially, Q = 0 and Q’ = 1.1. Since S=1, Q’ will change from 1 to 0after one NOR-gate delay (marked byvertical lines in the diagram for clarity).2. This change in Q’, along with R=0, causes Q to become 1 after another gate delay.3. The latch then stabilizes until S or Rchange again. SRQQ’0 1 2 3 4October 13, 2003 Latches 11Resetting the latch: SR = 01• What if S = 0 and R = 1? • Since R = 1, Qnextis 0, regardless of Qcurrent:Qnext= (1 + Q’current)’ = 0• Then, this new value of Q goes into the bottom NOR gate, where S = 0.Q’next= (0 + 0)’ = 1• So when SR = 01, then Qnext= 0 and Q’next= 1.• This is how you reset, or clear, the latch to 0. The R input stands for “reset.”• Again, it can take two gate delays before a change in R propagates to the output Q’next.Qnext= (R + Q’current)’Q’next= (S + Qcurrent)’October 13, 2003 Latches 12SR latches are memories!• This little table shows that our latch provides everything we need in a memory: we can set it, reset it, and remember the current value.• The output Q represents the data stored in the latch. It is sometimes called the state of the latch.• We can expand the table above into a state table, which explicitly shows that the next values of Q and Q’


View Full Document

U of I CS 231 - Lecture

Documents in this Course
Counters

Counters

23 pages

Latches

Latches

22 pages

Lecture

Lecture

33 pages

Lecture

Lecture

16 pages

Datapaths

Datapaths

30 pages

Lecture

Lecture

6 pages

Registers

Registers

17 pages

Datapaths

Datapaths

28 pages

Decoders

Decoders

20 pages

Load more
Download Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?