This project presents the design of four logic circuits are often used as components in larger, more complex circuits. Although they can be used by themselves in simpler settings, these components are more typically thought of as basic building blocks in larger, more involved circuits.
The four circuits are described using structural methods based on logic operators and logic gates (i.e., AND, OR, and NOT functions). In the project design requirements, these same circuits are defined in behavioral Verilog. This is a typical “text book” approach – logic circuits are introduced and described using structural methods, but designed and implemented using behavioral methods. After an initial learning phase involving several design projects, structural descriptions will largely be abandoned in favor of purely behavioral descriptions (recall that behavioral descriptions only define a circuit’s input-output relationships, but say nothing about how a circuit might be implemented).
Although it is easier, simpler and more natural to define circuits behaviorally, any given circuit description must be translated into a detailed structural form before it can be implemented. For many years, the main job of a design engineer was translating loose behavioral descriptions into detailed structural specifications. In more recent times, logic synthesizer tools took over that task. Today, virtually all digital circuit designs use logic synthesizers, and all modern design tools (like Vivado) include synthesizers as essential components.
Before you begin, you should:
- Be able to find a minimum circuit for any given behavioral description;
- Understand the general design flow for designing any digital circuit;
- Be comfortable using Vivado and the Blackboard to define and implement designs.
After you’re done, you should:
- Understand the design and use of multiplexors, decoders, encoders and shifters;
- Be comfortable defining slightly larger circuits;
- Be comfortable using the simulator for routine circuits.
The four basic logic circuits examined in this project include a multiplexer, a decoder, an encoder, and a shifter. Each of these circuits are developed and discussed in the topic documents, and code examples are provided in the tutorial. After learning about these circuits and their applications, you can use them in several designs.
With the tutorial above and the previous experience you’ve gained writing test benches and completing simulations, you should be able to complete the design requirements below. If you create multiple testbenches, and they are all listed in your project, then before running the simulation you must select which testbench file is active. Before clicking Run Behavioral Simulation, right click on the simulation source file you want to simulate and select Set as Top.
Design and simulate a 4:1 multiplexor, and then implement it in the Blackboard. Use two slide switches to select the multiplexor input, connect the four pushbuttons to the multiplexor input signals, and connect the output to an LED. Verify the circuit works correctly.
After programming this circuit onto your Blackboard, create a modified version of your code where the multiplexor inputs and output are 8-bits each. Simulate this modified circuit to verify that it works correctly.
Implement a decoder circuit that can enable one of four LEDs to be turned on when a corresponding pushbutton is pressed. You will need a 2:4 decoder whose inputs are driven from two slide switches, and whose outputs are AND’ed with pushbutton inputs. The AND gate outputs should drive four LEDs. When the circuit is implemented, the four pushbuttons should turn on the LEDs, but only if the slide switches have been set to enable that channel.
Create a Verilog description of a 4:2 priority encoder and a test bench that checks for all possible input patterns. Simulate the encoder to verify that it works properly. You do not need to implement this circuit.
Create and simulate a Verilog description for an 8-bit shifter that can shift or rotate left or right by 0, 1, 2, or 3 bit positions. Implement the shifter on your Blackboard, using eight slide switches for shifter input, eight LEDs for outputs, and the four premaining slide switches to select shifter function. Two switches will be used for shift amount, one for direction, and one for shift/rotate selection. When shifting, use a pushbutton to define the fill input. Verify the shifter works correctly on your board.
1. Minterm Multiplexor Circuit
Create a four input (SW0, SW1, SW2 and SW3), one output (LED0) Verilog circuit that uses a 4:1 behavioral multiplexor. Connect the multiplexor output to an LED, and connect the four inputs in such a way that minterms 3, 4, 6, 8, 9, 10 and 13 cause the LED to illuminate. (Hint: each input to the behavioral multiplexor will be driven by a simple logic function. Two of the slide switches will be inputs to these simple logic functions, and the other two will select the multiplexor channel).