Lab Session # 3 Complex Logic Design (Code Converter) : Figure 1: Multi-Input To Multi-Output Circuit
Lab Session # 3 Complex Logic Design (Code Converter) : Figure 1: Multi-Input To Multi-Output Circuit
1. Introduction
In this experiment, you will get introduced to the design of multi-input to multi-output circuits. In
addition, you will design and implement code converter using Quartus II Software.
2. Objectives
By the end of this lab experiment, students will:
• Be able to build complex logic circuits
• Be familiar with the concept of code conversion.
• Fit a synthesized circuit into a Cyclone IV E FPGA on Altera DE2-115 board.
• Assign circuit inputs and outputs to specific pins on the FPGA.
• Program and configure the FPGA to test the design physically using switches and LEDs.
The main concept of code converters is to convert from one type of input encoding to a different output
encoding. The availability of a large variety of codes for the same information results in the use of
different codes by different digital systems. It is sometimes necessary to use the output of one system as
input to another. A conversion circuit must be inserted between the two systems if each one uses
different code to represent the same information. Thus, a code converter is a circuit that makes two
systems compatible even though if each one uses a different encoding for its input.
To convert from binary code A to binary code B, input lines must supply bit combination as specified by
code A and the circuit must generate the corresponding output bit combination of code B. A
combinational circuit performs this transformation by means of logic gates. The design procedure will be
illustrated by the next example that converts a 3-bit binary digit to Excess-3 code.
1. From the specification of the circuit, determine the required number of inputs and outputs
and assign a symbol to each one of them, if they were not given in the problem statement.
2. Derive the truth table that defines the required relationship between inputs and outputs.
3. Obtain the simplified Boolean functions using Boolean algebra for each output as a function
of input variables.
4. Draw the logic diagram (graphical design) or write a Verilog code representing your design.
5. Simulate and check the functionality of the designed circuit.
6. Fit and analyze design performance of your design and download your design to the Altera
Cyclone IV E FPGA board to physically verify correctness of the design.
Design a binary to Excess-3 Code Converter that takes the numbers from 0 to 7 as inputs in binary format
(000, 001,…, 111) and displays the corresponding 4-bit excess-3 code. Simulate the designed circuit using
the waveform editor to verify its functionality. Also, test your design on Altera DE2-115 Board.
A B C W X Y Z
0 0 0 0 0 1 1
0 0 1 0 1 0 0
0 1 0 0 1 0 1
0 1 1 0 1 1 0
1 0 0 0 1 1 1
1 0 1 1 0 0 0
1 1 0 1 0 0 1
1 1 1 1 0 1 0
Example:
For the output W:
W = A B' C + A B C' + A B C
W = ( A B' C + A B C ) + ( A B C' + A B C )
W = ( A ( B' + B ) C ) + ( A B ( C' + C ) )
W=(A(1)C)+(AB(1))
W=(AC)+(AB)
W=AC+AB
In order to complete the design of Excess-3 converter circuit, you need to find logic
expressions for each output. Derive the expressions for X, Y, and Z by yourself.
For the output X:
input A, … ;
output W, … ;
endmodule
Step 5: Simulation
1. Synthesize your design for the implemented circuit (refer to Section 3.2.5 in Lab Session#1).
2. Perform Functional Simulation (refer to Section 3.4 in Lab Session#1).
Quartus II Software will generate additional files to allow the above mentioned tasks. These files are
listed in Table 2.
.flow.rpt
Compilation (in main project Folder) Compilation Flow Report
.fit.rpt
Fitting (in main project Folder) Fitter Report
.sta.rpt
Timing Analysis (in main project Folder) Timing Analyzer report file
Programming and .sof Assembler report – Stores device programming options and
Configuration (in main project Folder) information - Binary file for programming a Cyclone IV E device
Pin Assignment
DE2-115 board has hardwired connections between FPGA pins and other components available on the
board such as LEDs, switch…etc. These pins should be assigned to inputs and outputs of the circuit to
facilitate the verification of the downloaded design. To do this, follow the following steps:
i. List all the input and output signals of your design in Table 3.
ii. Refer to the pin configuration sheet for DE2-115 Board, provided to you by your
lab instructor.
iii. In order to test the circuit physically on DE2-115 Board, you need to assign inputs
and outputs to physical resources available on the board to supply input data and
observe output value. In this experiment, we will use switches (3 switches) to
supply inputs, and display the output values on LEDs (4 LEDs).
iv. Table 3 below shows how to assign input/output of your design to switches and LEDs. In
the table, a single input (i.e., A) and a single output (i.e., Z) are shown to be assigned to
pins on the board. Complete the pin assignment in the table for the remaining
inputs/outputs of your design.
Lab Exercise # 3
Problem Statement:
Design the Excess-3 code converter circuit using Quartus II Graphic Editor, Synthesize it and test its
functionality correctness (Functional Simulation and Programming Altera DE2-115 Board).
Procedure:
1. Create a Block Diagram/Schematic design file for the given circuit (refer to Section 3.2 in Lab
Session#1).
2. Synthesize it (refer to Section 3.2.5 in Lab Session#1).
3. Perform a Functional Simulation (refer to Section 3.4 in Lab Session#1) to test your design for all
the possible test cases (Table 1).
4. Download your design to Altera DE2-115 Board to check and verify its functionality correctness.
5. Print your design files and simulation waveforms.
Ask your engineer to check your results, write his/her comments and sign below:
………………………………………………………………………………………………………………………...…………………………...……….
……………………………………………………………………………………………………………………...………………………...…………….
…………………………………………………………………………………………………………………...…………………………………………
Engineer Signature
……..……………..
Attachments:
Please attach with the lab exercise sheet printouts of the files indicated below. Don't forget to
write your Name and ID Number as comments in every file before printing.