In the example of the computer processor running at 2.8 GHz, the clock will toggle 2.8 billion times a second, or once every 357 picoseconds! The clock on the Mojo isn’t quite that extreme. The time between edges is specified by the clock’s frequency. Falling edges occur the when the clock transitions from 1 to 0 and are used less often. Most of the time, the rising edge is the one you really care about. Rising edges occur when the clock transitions from 0 to 1 and are marked with a little up arrow in Figure 4-3. There are two types: the rising and falling edges. The important parts of the clock signal are the edges. Before we get into how these work, we need to cover what a clock is. There are three inputs, D, clk, and rst, and a single output, Q. Luckily, there is a circuit element known as the D-type flip-flop, or DFF, that will help us here.įigure 4-2 is a basic representation of a common DFF. We need to be able to control how often it changes. To make this work, we need a way to prevent the feedback from changing immediately. Basically, this is a mess and clearly not the way to keep a running total. The invalid outputs would cycle back to the input and produce more garbage. This would lead to each bit updating its value at slightly different times, giving invalid intermediate values at the input, which would in turn lead to invalid outputs. Binary numbers are represented with multiple bits, and the propagation delays for each bit would be different. If we built this circuit, how fast would total count up? Could we control the output at all? The speed it would count would be determinated by the incredibly short delay for the values to propagate through the logic gates. But if the output is 2, the inputs are 2 and 1, so the output should be 3. However, when the output is 1, the inputs are then 1 and 1, so the output should be 2. If we then change in to be 1, what is the output? Well, at first the two inputs are 0 and 1, so the output should obviously be 1. Imagine that somehow we know that total starts at 0. In this example, we loop the sum back to one of the inputs. The two inputs on the left are the two numbers to be added, and the output on the right is the sum. In this diagram, the box with a + in it represents an adder. In practice, it gets a little more complicated than that, though. In the example of the running total, we would need to feed the previous output back as another internal input. So how do we create circuits that can remember things? It’s quite simple: we need to have feedback loops. Each cycle (we will define what a cycle is later), it adds the current input to the previous sum, but the previous sum isn’t an input. This means that the circuit has some sort of memory to be able to keep track of what has happened before.Ī basic example is a circuit that keeps a running total of numbers. It should come as no surprise that because combinational logic is a type of circuit that depends only on the current inputs, the other type, sequential logic, is a type of circuit whose output depends on not only the current inputs but also the sequence of previous inputs. We will also introduce how to properly read external inputs and solve the challenges that can be associated with them. This chapter starts a new example project you will create a circuit that can keep track of a running total. Sequential logic is important for controlling the flow of data through your design as well as improving efficiency by allowing different sections of combinational logic to operate independently. In this chapter, we will cover what sequential logic is and, more specifically, what flip-flops are and how to use them.
0 Comments
Leave a Reply. |