Project 2 Logic Circuit Fundamentals

Introduction to transistors, logic circuits, and basic digital designs

21030

Introduction

This project provides further experience with logic circuits. First, you must download a prewritten Verilog program to configure your Blackboard with unknown logic circuits. Your assignment is to interact with the circuits, discover their response to all inputs, deduce their SOP and POS logic equations, and then re-implement them yourself. Next, two circuit requirements are presented as worded descriptions, and you must translate those into an engineering formalism (in this case, a truth table), design them, and check their performance on the Blackboard. Many new terms and concepts are introduced, so you are encouraged to read the topic documents as they are presented.

Before you begin, you should:

  • Have the Xilinx Vivado tool installed;
  • Have a Blackboard, and know how to program it;
  • Know how to start a Vivado project and construct a basic logic circuit;
  • Understand logic gates and basic logic circuits.

After you’re done, you should:

  • Be comfortable creating new designs in Vivado;
  • Be able to derive logic functions from truth tables;
  • Be able to define SOP and POS logic functions in Verilog;
  • Be able to translate a worded problem description into Verilog.

Background

In this project, you will take some significant steps towards designing your own digital logic circuits. The design process involves many steps that are best learned though doing actual designs, but some fundamental background knowledge will help that process – read the topic documents! If you understand and complete the requirements, you are highly encouraged to complete the challenge as well. And as always, you are invited to go “off script” and complete your own original design extensions as well. Just show the TA what you did, and they will give you extra points.

Requirements

1. Configure your Blackboard with a downloaded .bit file, and deduce the logic circuits it contains

Download and decompress the pre-compiled bitstream from the link below. After the decompressed .bit file is available on your computer, open the Hardware Manager from Vivado’s main IDE, autoconnect to the Blackboard, select “Program Device”, and select the .bit you just downloaded. The .bit file will configure your Blackboard with four different circuits that use slide switches as inputs and LEDs for outputs. After your Blackboard is programmed, you can interact with the circuits to deduce their design. and complete the truth tables below to document the behavior. Note you do not need to create a project for this task.

Blackboard_P2.Zip

Circuit 1

The first circuit uses slide switches SW0 and SW1 as inputs and LD0 as an output. Use the switches to apply all four possible input patterns, and record LD0’s response in the table below (note LD0 will illuminate when the circuit’s output is a ‘1’). When the table is complete, click “Check Result”.

SW1 SW0 LD0
0 0
0 1
1 0
1 1
Circuit 2

The second circuit uses SW1, SW2 and SW3 as inputs, and LD1 as an output. Probe Circuit 2 the same way you did Circuit 1, complete the truth table below, and check your results.

SW3 SW2 SW1 LD1
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Circuit 3

The third circuit uses SW4, SW5, SW6, and SW7 as inputs, and LD2 as output. Probe Circuit 3 the same way you did Circuit 1 and 2, complete the truth table below, and check your results.

SW7 SW6 SW5 SW4 LD2
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1

Create your own duplicate circuits

After you have correctly completed the truth tables, create your own circuits to implement the same behavior as the three circuits you just probed. Create a new Vivado project, and add a new Verilog source file. Define the eight slide switches as inputs, and three LEDs as outputs. Then, based on your truth table results, create Verilog assignment statements (using SOP logic) to drive the three LEDs exactly as they were driven in the downloaded file. Your competed Verilog module will have three assignment statements; the first one is provided, but you must write the other two. Your Verilog should similar to the code below.


module top (
    input [7:0] sw,
    output [2:0] led
);

assign led[0] = (sw[0] & ~sw[1]) | (~sw[0] & sw[1]);
assign led[1] = // you must write this statement
assign led[2] = // and this one too

endmodule

Create a new constraints file, and connect the Verilog “sw” inputs and “led” outputs to the proper pins on the ZYNQ device.

When your Verilog and constraints source files are complete, click “Generate Bitstream” to automatically run all the required implementation steps. (Note: In Vivado, if you execute a process that uses outputs from one or more previous processes, Vivado will automatically check to make sure all previous processes and files are up to date. If any files needed to be updated, Vivado will automatically run any required processes.)

2. Try POS Instead

Modify the source file from requirement 1 above by commenting-out the SOP equations, and then create POS equations to drive the LEDs in exactly the same way. The TA will check your source file to make sure both the SOP and POS versions are present.

3. Circuit 4

Program your Blackboard with the .bit file you downloaded in requirement 1. That .bit file contains a fourth circuit that uses SW3 – SW6 as inputs, and LD3 as an output. Probe this fourth circuit, create a new Verilog source file that behaves identically, program your Blackboard, and verify it performs identically. Create a K-Map or Truth Table when identifying the logic of the circuit, and be prepared to show it when being graded.

4. Create a New Circuit

Create a Verilog source file to define a circuit that uses four pushbuttons as inputs, and drive six different LEDs as outputs from these same four inputs:

  • Illuminate one LED whenever a single input is asserted;
  • Illuminate a second LED whenever any two inputs are asserted;
  • Illuminate a third LED whenever any three inputs are asserted;
  • Illuminate a fourth LED whenever all four are asserted;
  • Illuminate a fifth LED whenever an odd number of inputs are asserted;
  • Illuminate a sixth LED whenever an odd number of inputs are asserted.

Challenges

1. LED Controller Using Switches

A digital system includes 3 5-bit “unlock” codes: 10010 (18d), 00101 (5d), and 11010 (26d). Design and implement a circuit that can illuminate an unlock LED when a pushbutton is pressed, but only if one of these unlock codes is present on the lower five slide switches.

2. Large Number Detector

Design a circuit that can detect when a number >= 256 present on the slide switches.