Confusion between tick/tock and times

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

Confusion between tick/tock and times

gs99
Please clarify this confusion I have for tick and tock.

In RAMxxx scripts, if "set load 1" is in tick, then the input is outed in tock.
Example, if RAM8.tst file has these lines:
set in 2,
set address 3,
set load 1,
tick,
output;
tock,
output;

RAM8.out has:
| time |   in   |load |address|  out   |
| 0+   |      2 |  1  |   3        |      0 |
| 1     |      2 |  1  |   3        |      2 |
Time 0+ is output from tick, then time 1 is output from tock, correct?

But Figure 3.5 Counter simulation on page 51 shows similar actions occurring in separate “times” (E.g. The load bit is asserted in time 29, and the input of 527 is outed in the next time 30). The clock row seems to indicate tick and tock as parts of each time.
What happens in the script “tick and then tock” seems to happen in Counter simulation in two consecutive times – “time and then next time”.
I assume Counter simulation generally represents what happens for RAMxxx chips regarding clock operation.  


Reply | Threaded
Open this post in threaded view
|

Re: Confusion between tick/tock and times

cadet1620
Administrator
I don't know the internals of the Hardware Simulator so I can't really answer this. Figure 3.5 is correct. If you look closely enough you will see that the edges of the reset, load and inc are slightly to the right of the clock falling edges.  It would be better if these were offset a bit more so that it was easier to see.

The  square wave clock as drawn in figure 3.5 is a hardware detail that isn't really required. The clock could be a series of narrow pulses, or some other hardware implementation.

What's important is to understand that the clock is a periodic event. When a clock event occurs the state of the inputs determines the new output state.

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

Re: Confusion between tick/tock and times

gs99
I'm not into hardware details either, just learning the basic operation.

What I'm saying is that the words "tick" and "tock" in Hardware Simulator test files seem to be equivalent to "time" elsewhere.

Description of "The Clock" on page 42 says a time unit (clock cycle) includes a tick and a tock.

But the general teaching of sequential logic seems to be:
time 0 set values
time 1 read the values
as shown in examples of Figure 3.5.

and not:
tick set values
tock read values
that we see in scripts.

Isn't there a conflict of terminology?
Reply | Threaded
Open this post in threaded view
|

Re: Confusion between tick/tock and times

cadet1620
Administrator
See this post.

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

Re: Confusion between tick/tock and times

gs99
Thanks for that information.
After doing more research, I'm reporting these conclusions.
Please let me know if I'm wrong on anything, or any comments.
My status: completed RAM8

1. Positive-Negative
Commercial D Flip flops are available with positive edge trigger type.
But play-hookey.com ignores that option. No problem.  

This comment is made on the first (The RS Flip-Flop) in the series:
"Therefore, the Q and Q' outputs can only change state when the CLK signal falls from a logic 1 to logic 0.
This is known as the falling edge of the CLK signal; hence the designation edge-triggered flip-flop."
http://www.play-hookey.com/digital/sequential/rs_nand_flip-flop.html

But the term "edge-triggered flip-flop" can also refer to those that change state when CLK rises from 0 to 1.

On their D Flip-Flop, when CLK goes from 1 to 0, Q changes to D, indicating a falling (negative) edge.
http://www.play-hookey.com/digital/sequential/d_nand_flip-flop.html
Try it:
A. Reload page so CLK, D, and Q are 0. Press CLK many times, output does not change (no surprise).
B. Reload page. Press D to 1. Press CLK to 1; Q=0. Press CLK to 0; Q=1. Press CLK many times, no change.
C. Reload page. Press CLK to 1; Press D to 1. Q=0. Press CLK to 0; Q=1. "  "
Example C shows: Even if D is set to 1 after CLK is 1, Q changes to 1 when CLK goes to 0.

On one web site, the symbol for a falling edge DFF has a small circle on outside of DFF (touching the clock triangle).
In Logisim, the DFF symbol does not have that circle, but it operates as falling edge.
I made a Logisim D Flip-Flop as shown in play-hookey.com; it behaves in the same way.
And apparently Hardware Simulator is negative also.

Are there any advantages of either - positive or negative?

2. How does CLK on these diagrams relate to the "tick" and "tock" of Hardware Simulator?
Evidently "tock, output;" represents the out status after CLK goes from 1 to 0.
That's the important clock event.

As shown above in Example C, all the time before clock goes to 0 is available for input changes.
Even after setting CLK to 1, D can be changed and recognized.

However, IMO, HardwareSimulator "tick, output;" represents an arbitrary cutoff time, after which input changes are not recognized.
In these lines:
tick, output;
set load 1,
set in 0,
tock, output;
the input changes set after tick, output; are not recognized when CLK goes to 0 ("tock, output;").


3. It's misleading to say we set an input at time t+ (tick) or at time t (tock), such as:
cadet1620 wrote
When we set an input at time t (tock).
Technically, as you have stated, "What's important is to understand that the clock is a periodic event."
That is, tick and tock are events. In a negative system, tock is the important event.
Isn't it more accurate to say we can set input Before tick or Before tock events?

When playing with D Flip Flop (8 Nands, IN: D and CLK, OUT: Q and Q'), I can change D many times in a time period.
But when I finally press CLK 1 to 0 (clock event), whatever is in D goes to Q.

Getting back to Figure 3.5, the clock row represents the oscillating clock signals.
In order to get a negative edge, the electronics must go positive first.
But in a negative edge system, when it goes positive is not really important.
Combinational changes can be made generally before or after the positive edge, recognizing certain "margins".

But in Hardware Simulator, "tick, output;" is a programming point at which all the input is edited and recognized for tock.
This artificial separation is not seen in interactive diagrams such as play-hookey or Logisim.  
This is not a problem with HS; we only need to set inputs before tick.

George
Reply | Threaded
Open this post in threaded view
|

Re: Confusion between tick/tock and times

cadet1620
Administrator
gs99 wrote
On one web site, the symbol for a falling edge DFF has a small circle on outside of DFF (touching the clock triangle).

In Logisim, the DFF symbol does not have that circle, but it operates as falling edge.
I made a Logisim D Flip-Flop as shown in play-hookey.com; it behaves in the same way.
And apparently Hardware Simulator is negative also.

Are there any advantages of either - positive or negative?
The standard symbology uses the presence or absence of the triangle inside the symbol to indicate edge vs. level triggered. The small circle means falling edge or false level triggering. No circle, positive edge or true level trigger.

You can set Logisim's flip-flops to any of the above four triggering options, but it doesn't change its symbol.

There's a lot of intricate timing involved in real hardware. Having both positive and negative edge triggered logic available lets the designer achieve the timing needed for a reliable design at highest possible speeds. There was one chip designed for use in magnetic media read circuits that was "dual edge" triggered; both positive and negative clock edges latched data into the chip.
2. How does CLK on these diagrams relate to the "tick" and "tock" of Hardware Simulator?
Evidently "tock, output;" represents the out status after CLK goes from 1 to 0.
That's the important clock event.
The Hardware Simulator is by no means a simulator of real hardware, it is a theoretical simulation of idealized synchronous sequential circuits. Trying to relate its behavior to real hardware is nonsensical.
3. It's misleading to say we set an input at time t+ (tick) or at time t (tock), such as:
cadet1620 wrote
When we set an input at time t (tock).
The Hardware Simulator only has two discrete time quanta, tick and tock, so those are the only times that the "set" command can be applied.


If you care to take a look at it, here is a bi-directional edge triggered flip-flop implemented in Logisim.
bi-edge-ff.zip

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

Re: Confusion between tick/tock and times

gs99
cadet1620 wrote
The Hardware Simulator is by no means a simulator of real hardware, it is a theoretical simulation of idealized synchronous sequential circuits. Trying to relate its behavior to real hardware is nonsensical.
From our textbook:
“We believe that the best way to understand how computers work is to build one from scratch… The computer system described in the book is for real–– it can actually be built, and it works!”–– Preface.
 
“We provide a simple hardware simulator that is sufficiently powerful to support sophisticated hardware design projects. In particular, the simulator provides all the necessary tools for building, testing, and integrating all the chips presented in this book, leading to the construction of a general-purpose computer.”–– p. 17.

I have confidence that Hardware Simulator behaves as real hardware, for our purpose here.
And I’ve found it helpful to understand how its “tick” and “tock” relate to other learning methods (e.g. interactive diagrams in Logisim and play-hookie.com). Hope others may benefit in same way.

QQ
The Hardware Simulator only has two discrete time quanta, tick and tock, so those are the only times that the "set" command can be applied.
I was thinking in simpler terms of what you said earlier:
"What's important is to understand that the clock is a periodic event."  
That led me to learn about the falling edge (at play-hookie.com) and how it relates to tock.

Also, up to the point of building RAM8, we’ve been entering “set” lines Before the tick and tock events, e.g.
set load 1,
set in 0,
tick, output;
tock, output;

Now I need to get back to making RAM64.