Project 2 Logic Circuit Fundamentals

Introduction to transistors, logic circuits, and basic digital designs

3806

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

An automobile controller receives several sensor inputs from various engine systems. Four of the sensors are: Coolant Temperature (CT) that outputs a “1” when the coolant temperature exceeds 200 degrees; Coolant Low (CL) that outputs a “1” when the coolant level falls below 60% of capacity; Oil Temperature (OT) that outputs a “1” when the oil temperature exceeds 180 degrees, and Oil Low (OL) that outputs a “1” when the oil level falls below 75% capacity.

Design and implement a warning light system that:

  1. Illuminates a yellow light whenever any of the following are true:
  • Only the Coolant Level is low
  • Only the Oil Level is low
  • The Oil Temperature is too high and the Oil Level is OK
  • The Coolant Temperature is too high and the Oil Level is too low
  1. Illuminates a Red light (using the other LED package) whenever any of the following are true:
  • The Coolant temperature is too high and the Coolant level is too low
  • The Oil Temperature is too high and the Oil Level is too low
  • The Coolant and Oil Temperatures are too high at the same time
  • The Coolant and Oil levels are too low at the same time that the Coolant Temperature is too high and the Oil Temperature is OK.

Create a Verilog description of a circuit that meets these requirements, and implement the circuit on your Blackboard. Use four slide switches to represent the sensor inputs and use two RGB LEDs for the outputs.

Challenges

1. LED Controller Using Switches

Illuminate an LED only when exactly two of the first four slide switches (SW0, SW1, SW2, SW3) are set to “1”. Illuminate a second LED when exactly three of the next four switches (SW4, SW5, SW6, SW7) are set to “0”.