3.1.时序逻辑
\(3.1.\)Sequential Logic
1.Background
In the previous chapter, we've completely ignored the issue of time:
Everything happened immediately, there were inputs and immediately the outputs were some function of them.
The inputs never change, we didn't have any notion of change.
We didn't have any notion of things happening one thing after another. Just was some kind of logical mapping from inputs to outputs.
So, there are two things that we want to complement:
Be able to use the same hardware to compute many things one time after another. We need to be able to reuse our hardware.
- For example, if we take some kind of loop in a hard, in a, in some kind of software program, that the loop calls for doing the same thing many times, we want to be able to use a same hardware to do that.
Remember things from the past.When we need to remember intermediate results,we need to remember where we are in a computation.
2.The clock
What we're going to do is to convert the continuous physical time into discrete time.
To do this, we're going to have a clock:
- It is some kind of oscillator going up and down at a certain fixed rate.
- Each cycle of the clock is treated as one digital integer time unit.
With each time unit, we are going to deal it as a indivisible thing. Nothing changes in a time unit.
In a time unit, it will compute the output from the input in an instantaneous manner.
3.Delay
However, for a physical signal, it doesn't change instantaneously in a number time between time as we suppose. In reality, the little course current builds slowly, and the voltage may change slowly. That is to say, the actual analog signal takes time to reach its final stage, both input and output.
Therefore, we will give ourselves enough time between consecutive time units. For example, we will give the logical operations at the end of the grey area to make sure that all the hardware there really stabilizes:
And then,we can simply ignore these inconsistencies because now,whatever happened before the gray area,we don't need to worry about it because we know it's gone by the end of the clock cycle.
4.Combinatorial logic
- Combinatorial logic: It's a stateless logic, where the output depends solely on the current input state:\(out(t)=f(in(t))\). Our ALU and bool chips take this logic.
- Sequential logic: \(out(t)=f(in(t-1))\).
5.State feedback
The sequential logic points out a new way of thinking, which is to consider inputs and outputs as the same bits, capable of being transmitted on the same bus and occupying the same hardware location. This design allows us to feed output values back to the input, creating a state rather than simply passing data. Thus, we can use a particular bit in the circuit to store state information rather than solely transmitting data.
This new way of thinking alters our understanding of time. Instead of viewing time as continuous, we now divide it into discrete integer time steps and observe the events happening sequentially at each time step. This approach enables us to change the state incrementally, remembering the result from the previous time step at each subsequent step and building upon it.