Computer Logic Labs
Computer Logic Labs
IN FOREIGN LANGUAGES
GUIDELINES
FOR LABORATORY WORK
Composed by
Dariia E. Kucherenko
KHARKOV 2013
Guidelines for laboratory work of the discipline “Computer logic” for students of
specialty 6.050102 “Computer engineering” / Redactor: Syrevitch Yev.Yef.,
Kucherenko D.Yef. –Kharkov:KNURE, 2013. − p.
Introduction ………………………………………………………………….. 4
The Spartan 3E Starter Board provides a powerful and highly advanced self-
contained development platform for designs targeting the Spartan 3E FPGA from
Xilinx. It features a 500K gate Spartan 3E FPGA with a 32 bit RISC processor and
DDR interfaces.
4
The board also features a Xilinx Platform Flash, USB and JTAG parallel
programming interfaces with numerous FPGA configuration options via the onboard
Intel StrataFlash and ST Microelectronics Serial Flash. The board is fully compatible
with all versions of the Xilinx ISE tools including the free WebPack. The board ships
with a power supply and USB cable for programming so designs can be implemented
immediately with no hidden costs.
The key features of the Spartan-3E Starter Kit board are:
Xilinx XC3S500E Spartan-3E FPGA
Up to 232 user-I/O pins
320-pin FBGA package
Over 10,000 logic cells
Xilinx 4 Mbit Platform Flash configuration PROM
Xilinx 64-macrocell XC2C64A CoolRunner CPLD
64 MByte (512 Mbit) of DDR SDRAM, x16 data interface, 100+ MHz
16 MByte (128 Mbit) of parallel NOR Flash (Intel StrataFlash)
FPGA configuration storage
MicroBlaze code storage/shadowing
16 Mbits of SPI serial Flash (STMicro)
FPGA configuration storage
MicroBlaze code shadowing
2-line, 16-character LCD screen
PS/2 mouse or keyboard port
VGA display port
10/100 Ethernet PHY (requires Ethernet MAC in FPGA)
Two 9-pin RS-232 ports (DTE- and DCE-style)
On-board USB-based FPGA/CPLD download/debug interface
50 MHz clock oscillator
SHA-1 1-wire serial EEPROM for bitstream copy protection
Hirose FX2 expansion connector
Three Digilent 6-pin expansion connectors
Four-output, SPI-based Digital-to-Analog Converter (DAC)
Two-input, SPI-based Analog-to-Digital Converter (ADC) with
programmable-gain pre-amplifier
ChipScope™ SoftTouch debugging port
Rotary-encoder with push-button shaft
Eight discrete LEDs
Four slide switches
Four push-button switches
SMA clock input
8-pin DIP socket for auxiliary clock oscillator.
The kit includes a standard USB Type A/Type B cable, similar to the one
shown in figure i.2.
5
Figure i.2 – Standard USB Type A/Type B Cable
The wider and narrower Type A connector fits the USB connector at the back
of the computer. After installing the Xilinx software, connect the square Type B
connector to the Spartan-3E Starter Kit board, as shown in figure i.3.
Figure i.3 – Standard the USB Type B Connector to the Starter Kit Board Connector
The USB connector is on the left side of the board, immediately next to the
Ethernet connector. When the board is powered on, the Windows operating system
should recognize and install the associated driver software. When the USB cable
driver is successfully installed and the board is correctly connected to the PC, a green
LED lights up, indicating a good connection.
This course introduces the VHDL language and then provides a series of
tutorials that demonstrate the use of VHDL running on a Xilinx CPLD. It starts with
some very basic and easy examples that will get the beginner in VHDL started
comfortably. VHDL is an industry-standard language for modeling and synthesizing
digital hardware, particularly for programmerable logic or Application Specific
Integrated Circuits. The VHDL simulation serves as a basis for testing complex
designs and validating the design prior to fabrication. As a result, the redesign is
reduced, the design cycle is shortened, and the product is brought to market sooner. A
VHDL program can be considered as a description of a digital system; the associated
simulator will use this description to produce behavior that will mimic that of the
physical system.
The software used to write the VHDL code and program the CPLD is the free
Xilinx ISE software (called WebPACK). Xilinx Integrated Software Environment
(ISE) – is design software suite which allows you to take your design from design
entry through Xilinx device programming. The ISE Project Navigator manages and
processes your design through several steps in the ISE design flow. These steps are
Design Entry, Synthesis, Implementation, Simulation/Verification, and Device
Configuration.
6
1 INTRODUCTION TO THE ENVIRONMENT PROJECT NAVIGATOR
CAD-PACKAGE XILINX ISE 14.6
This lab is an introduction to logic design using VHDL with the Xilinx ISE x.y
tools. No new logic design concepts are presented in this lab. The goal of this lab is
for you to become familiar with the tools you will be using for the rest of the
semester: The Xilinx ISE Project Navigator and The Xilinx Spartan-3E Starter Kit.
Please read carefully, pay attention, and take your time.
In order to receive credit for this lab, you must demonstrate to the instructor
that your final design works correctly in hardware. The details of the required
demonstration are at the end of the lab handout.
Before the work it is necessary to study theoretical material and lecture notes.
7
Figure 1.1 − New Project Dialog 1 of 3
You are prompted to enter a project name, a project location, and a top level
source type, as shown in figure 1.1. You may change the project location to another
folder if you wish.
Do not use file or folder names that contain spaces. I advise all students to
purchase a USB Flash Drive and store their labs on removable media. Even though
you are doing most of your work from home, you must have some means to transport
your project to the lab if you need help debugging it. Never store your projects on the
lab machines!!!
When you are satisfied with the project name and location, click “Next”.
The next dialog allows you to set additional project options.
8
The first group of settings shown in figure 1.2 represents the FPGA that is
available to you on the Spartan-3E Starter Kit board. The second group of settings
represents the design entry language, synthesis tool, and simulator preferences. Set
the options as shown in figure 1.2 and click “Next”.
The final dialog box in the new project process, shown in figure 1.3, provides a
summary of the project that Project Navigator will create based on your settings.
Review the summary to make sure it matches what is shown in figure 1.3. If it does
not, go “Back” and correct any errors. Otherwise, click “Finish” to complete this
process.
At this point, the project has been created but it does not contain any source
files. Create a new source file for the new design. Either select Project→New
Source from the main menu or use the equivalent process in the Processes window.
The first of the New Source dialog boxes will appear, shown in figure 1.4.
9
Select VHDL Module to indicate you are creating a VHDL design module.
Then, provide a filename as shown in figure 1.4. You should not need to change the
specified location, which should be inside the project directory you created earlier.
Click “Next”.
The next dialog optionally allows you to specify the ports of the module. This
may also bedone in the text editor, when creating the module, so skip it at this stage.
Simply confirm that the settings match those shown in figure 1.5 and click “Next”.
The final dialog box in figure 1.6 provides a summary of the source that Project
Navigator will create based on your settings. Review the summary to make sure it
matches what is shown in figure 1.6. If it does not, go “Back” and correct any errors.
Otherwise, click “Finish” to complete this process.
10
Figure 1.7 − The window of your future project
Project Navigator is divided into four sub-areas (fig. 1.7). On the top left is the
Sources window which hierarchically displays the elements included in the project
for the currently selected stage of the design flow. Beneath the Sources window is the
Processes window which displays available processes for the currently selected
source. The third area at the bottom is the Console window which displays status
messages, errors, and warnings. The fourth area, on the top right, is for viewing and
editing project files. Each window may be resized or moved within Project
Navigator. The default layout can always be restored by selecting View → Restore
Default Layout.
In the text editor, some of the basic file structure is already in place although
we are going to replace everything that was automatically generated. Keywords are
displayed in blue, data types in red, comments in green, and values in black. This
color-coding enhances readability and recognition of typographical errors.
Now, you can enter the VHDL-code of the combinational circuit design. But,
before that you have to learn methods of combinational circuits’ synthesis and way of
its representation.
Let’s create the design of the combinational circuit to display number in the
binary system (figure 1.8).
11
Figure 1.8 − LED’s for binary number representation
The input decimal number X have to be represent in the binary system. For
example,
X in decimal system X in binary system
5 101
It means that X is vector which consists of 3 bits. You can see the following
VHDL code for our design:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL; The connection of the libraries.
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity lab is
The description of the input and
port (x:inout std_logic_vector (2 downto 0);
output.
y:out std_logic_vector (2 downto 0));
end lab;
The dimension of these vectors has to
be the same.
architecture Behavioral of lab is
begin
The description of the architecture
x<="101";
body (the function of the circuit).
y<=x;
end Behavioral;
This template of the VHDL-code you have to change according to your variant
and paste to the Test editor of the Project Navigator. At this point, you should end up
with a window that looks somewhat like that shown in figure 1.9. Once you are
satisfied, save the file and close the window. It is a good idea to get in the habit of
saving your project. There are options on the main menu to save individual files or
the complete project (Ctrl+S).
12
Figure 1.9 − Completed Design
With a functionally correct design description in VHDL, the next step is to use
a synthesis tool to transform your description into a netlist. A netlist is a machine-
readable schematic.
To locate the synthesis process, set the Sources window to display sources for
Synthesis/Implementation. If you select the lab.vhd source file, you should then see
Synthesize-XST as an available process in the Processes window.
Double click on Synthesize-XST to run the synthesizer. When it has finished,
you should see a green checkmark next to this process as shown in figure 1.10.
13
Figure 1.10 − Design synthesize complete
You should not see any errors in the Console window. However, you should
always review the log file, which is available for viewing if you expand the
Synthesize-XST process item by clicking on the + next to it. Select View Synthesis
Report. If you don’t understand a particular message, you should not simply ignore
it. Instead, search the Xilinx support web site or ask the instructor.
14
Figure 1.11 – Spartan 3E Starter Board
Your design description, which you have now synthesized, has a number of
ports at the top level. The implementation tools need to know how to assign the ports
in your top level to physical pins on the FPGA, which are connected to various
resources on the Spartan-3E Starter Kit board. If you do not make explicit
assignments, the tools will randomly assign pins for you. However, this is generally a
bad idea because random assignments will be wrong.
You now have enough information to create what is called a user constraint
file, or UCF. This file contains design constraints that you did not specify in the
VHDL description, such as pin location and design performance constraints. It is
convenient to provide them in a UCF rather than in the VHDL description. For
instance, if you make a mistake in the pin assignments, you do not need to go back
and re-synthesize your design.
Specify the pin locations for the ports of the design so that they are connected
correctly on the Spartan-3 Startup Kit demo board.
To constrain the design ports to package pins, do the following:
1. Verify that lab.vhd is selected in the Sources window.
2. Select Project→New Source from the main menu or use the equivalent pro-
cess in the Processes window. The first of the New Source dialog boxes will appear,
as shown in figure 1.12.
15
Figure 1.12 − New Source Dialog 1 of 2
This time, however, you will notice that the new source file is not automatically
16
opened in any editor.
5. Verify that lab.ucf is selected in the Sources window as shown in figure
1.14.
6. Click to + next to User Constraints and select text editor by choosing Edit
Constraints (Text). Paste following strings to field of editor and change according to
your variant.
NET "y(2)" LOC = "E11";
NET "y(1)" LOC = "E12";
NET "y(0)" LOC = "F12";
During this lab we will use only LEDs to observe the result. The names of the
physical pins on the board for LEDs represent below.
Now that you have a constraint file in your project, you can implement the
design. Select lab.vhd in the Sources window. Then, double click on the Implement
Design process in the Processes window (fig. 1.15).
17
Figure 1.15 − Design Implementation
You should not see any errors in the Console window. However, you should
always review the three log files, which are available for viewing if you expand the
Implement Design process item by clicking on the + next to it. There are log files
located under Translate, Map, and Place and Route. If you don’t understand a
particular message, you should not simply ignore it. Instead, search the Xilinx
support web site or ask the instructor. At this point, you should have a green
checkmark next to the Implement Design process (fig. 1.15).
Programming the FPGA directly is a convenient way to try out a design. The
first order of business is to create a programming file for the FPGA. Select lab.vhd in
the Sources window. Then, double click on the Generate Programming File
process in the Processes window (fig.1.16). Project Navigator will generate a
programming file and print information to the Console window.
18
Figure 1.16 − Programming file generation
Before you continue, you must have the Spartan-3E Starter Kit board,
power supply, and USB cable available. Connect the USB cable to an available
USB port on the computer you are using. Plug the power supply into the wall. Then,
insert the power plug into the Power Jack and turn on the power. Be aware that if a
programming file was previously stored on the board, it will automatically load, and
may result in board activity like flashing LEDs, etc… This can be safely ignored.
Finally, connect the USB cable to its connector. As a side note – if this is the first
time you have used your board, the Windows New Hardware Wizard will run several
times while the drivers for the board are installed.
To download your bitstream to the FPGA device, click on the + next to
Configure Target Device, and then double click on the Manage Configuration
Project (iMPACT) process (fig. 1.17).
19
Figure 1.17 − iMPACT program launch loading
This will launch the iMPACT program in another window. The rest of the
tutorial is performed in iMPACT. When iMPACT launches, you will be presented
with a main window (fig. 1.18).
20
The board has an integrated JTAG programming function, which is also called
Boundary Scan. Now, double click on the Boundary Scan process in the iMPACT
Flows window (fig.1.18). iMPACT program launch will open Boundary Scan
window. Here right click to initialize JTAG chain (fig.1.19).
After that, you will see the next message (fig. 1.20).
Next, you should get a sequence of three file requestors. In the first file
requestor, shown in figure 1.21, select the lab.bit file you created with the
implementation process. This is the FPGA programming file.
21
Next, you will see the next window (fig. 1.22). Click “No”.
Now, you will see the next files requestors. The purpose of the next two file
requestors is to identify programming files for other Xilinx devices on the board. We
are not programming either of these yet, so select BYPASS FOR BOTH (fig. 1.23).
Figure 1.23 − New configuration file for other Xilinx devices on the board
Now, you will see the next window with programming properties (fig. 1.24).
Do not change anything at this time; simply click “Ok” to proceed.
22
Finally, you will reach the display shown in figure 1.25. iMPACT is ready to
program the FPGA. Select the FPGA icon in the window and then use the right
mouse button to activate the menu as shown and select the Program option (fig. 1.25).
Note here, that the Assign New Configuration File option may be used to change
your configuration file assignments if you should ever need to do so.
Now, right click on the first cheap and choose program. A progress indicator
will appear(figure 1.26).
Once the programming is complete, the program will be sure to let you know if
it was successful or if it failed.
If the programming has failed, re-check your cable connections, the power
connections, and the jumpers – and then try again. If it still fails, ask the instructor for
assistance.
Now, you can test your design in hardware. For our example, we have to
observe number 5dec (101bin): the led 2 and led 0 should be lit (fig. 1.13).
23
1.4.6 In-lab assignment
During this lab you will develop the combinational circuit design using VHDL
24
language. For this purpose you will use minimization by Carnaugh map. To control
the correctness of your design you will program the Spartan-3E Starter Kit board.
Before the work it is necessary to study theoretical material and lecture notes.
Based on the truth table let’s create a Carnaugh map (fig. 2.1).
25
Figure 2.1 − Carnaugh map
You can see the following VHDL template for our design:
library IEEE;
use IEEE.std_logic_1164.all;
entity comb_circt is
port ( x1: in STD_LOGIC;
x2: in STD_LOGIC;
x3: in STD_LOGIC;
x4: in STD_LOGIC;
y: out STD_LOGIC );
end comb_circt;
architecture arch of comb_circt is
begin
y <= ((not x4) and (not x3)) or ((not x1) and (not x4)) or ((not x3) and (not x2));
end arch;
Below you can see the UCF code for our design. You can use it without any
changing.
NET "x1" LOC = "L13";
NET "x2" LOC = "L14";
NET "x3" LOC = "H18";
NET "x4" LOC = "N17";
NET "y" LOC = "F12";
26
2.3.3 In-lab assignment
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and output and the VHDL model with comments.
27
3 MULTIPLEXER/DEMULTIPLEXER DESIGN
The goal of this lab is to become familiar with describing a digital circuit of
multiplexer or demultiplexer using truth tables, different types of the VHDL
descriptions.
Before the work it is necessary to study theoretical material and lecture notes.
28
A 2-to-1 multiplexer (MUX) has a boolean equation where A and B are the two
inputs, S is the selector input, and Z is the output (fig. 3.1).
This truth table should make it quite clear that when S = 0 then Z = A but when
S = 1 then Z = B. A straightforward realization of this 2-to-1 multiplexer would need
2 AND gates, an OR gate, and a NOT gate. Symbol z means the state of high
impedance or high resistance on output (break connection).
Larger multiplexers are also common and, as stated above, requires log 2 n
selector pins for n inputs. Other common sizes are 4-to-1, 8-to-1, and 16-to-1 (fig.
3.2). Since digital logic uses binary values, powers of 2 are used (4, 8, 16) to
maximally control a number of inputs for the given number of selector inputs.
Figure 3.2 − MUX 4-to-1 (a), MUX 8-to-1 (b), MUX 16-to-1 (c)
So, there are several possibilities to describe the same multiplexer. We will
consider couple of them.
− Using conditional concurrent signal assignment.
output_signal <= input_signal_1 when control_signal = “___” else
input_signal_2 when control_signal = “___” else
input_signal_3 when control_signal = “___” else
input_signal_4 when control_signal = “___” else
‘X’;
− Using selected concurrent signal assignment.
with control_signal select
output_signal <= input_signal1 when “___”,
input_signal2 when “___”,
input_signal3 when “___”,
input_signal4 when “___”,
‘X’ when others;
29
− Using Process Statement and IF Statement to choose the corresponding
output.
process (control_signal) is
begin
if control_signal = “___” then output_signal <= input_signal_1;
elsif control_signal = “___” then output_signal <= input_signal_2;
elsif control_signal = “___” then output_signal <= input_signal_3;
elsif control_signal = “___” then output_signal <= input_signal_4;
else output_signal <=‘X’;
end if;
end process;
− Using Process Statement and CASE Statement to choose the corresponding
output.
process (control_signal) is
begin
case control_signal is
when “___” => output_signal <= input_signal_1;
when “___” => output_signal <= input_signal_2;
when “___” => output_signal <= input_signal_3;
when “___” => output_signal <= input_signal_4;
when others => output_signal <=‘X’;
end case;
end process;
This truth table should make it quite clear that when S = 0 then F0 = D but
when S = 1 then F1 = B. A straightforward realization of this 2-to-1 multiplexer
would need 2 AND gates and a NOT gate. You can easily describe it like a regular
switching circuit.
But in this lab we are trying to describe circuits like they are in real hardware.
So, there are several possibilities to describe the same demultiplexer. We will
consider couple of them.
− Using simple concurrent signal assignment.
output_signal_1 <= input_signal and control_signal and … ;
output_signal_N <= input_signal and control_signal and … ;
30
− Using Process Statement and IF Statement to choose the corresponding
output.
process (control_signal, input_signal) is
begin
if control_signal = “____” then output_signal_1 <= input_signal;
elsif control_signal = “____” then output_signal_2 <= input_signal;
elsif control_signal = “____” then output_signal_3 <= input_signal;
elsif control_signal = “____” then output_signal_4 <= input_signal;
else output_signal_1 <=’X’;
output_signal_2 <=’X’;
output_signal_3 <=’X’;
output_signal_4 <=’X’;
end if;
end process;
− Using Process Statement and CASE Statement to choose the corresponding
output.
process (control_signal) is
begin
case control_signal is
when “____” => output_signal_1 <= input_signal;
when “____” => output_signal_2 <= input_signal;
when “____” => output_signal_3<= input_signal;
when “____” => output_signal_4 <= input_signal;
when others => NULL;
end case;
end process;
The number of your variant pick up according to the serial number in your
register (table 3.1). The task will contain: type of the circuit – multiplexer
(demultiplexer) and variants of the VHDL description.
31
Continuation of the table 3.1
11 MUX «8 to 1» Using selected concurrent signal assignment
12 DEMUX «1 to 8» Using Process Statement and IF Statement
13 MUX «3 to 1» Using Process Statement and IF Statement
14 DEMUX «1 to 3» Using Process Statement and CASE Statement
15 MUX «4 to 1» Using Process Statement and CASE Statement
Create project of the device according to your variant using required types
of the VHDL description. Be sure that you have obtained the truth table for the
circuit according to your variant. Do not forget to draw a block schematic.
Don’t forget that before implementation you have to create
Implementation constraints file (*. ucf) to identify which FPGA pins are used for
your inputs and outputs variable.
You can use following names of FPGA pins (figl 3.4).
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and outputs (block circuit), the VHDL model with comments
and the results of synthesis in WebPack software (RTL circuit).
32
2. VHDL selected and conditional signal assignment?
3. What does the term “std_logic” mean?
4. How to assign pins with constraints for I/Os if the input signal is vector?
5. Write a behavioral code for the given block circuit using different types of
VHDL description.
4 ENCODER/DECODER DESIGN
Before the work it is necessary to study theoretical material and lecture notes.
There are several simple combinational devices, which can be used in real life.
They are multiplexers, demultiplexers (lab № 3), encoders, decoders. The encoder
and decoder are different kind of combinational circuits which are used to convert
binary information to decimal, octal and hexa decimal and vice-versa.
An encoder is a device used to change incoming information into a code. The
code may serve any of a number of purposes such as compressing information for
transmission or storage, encrypting or adding redundancies to the input code, or
translating from one code to another. This is usually done by means of a programmed
algorithm, especially if any part is digital, while most analog encoding is done with
analog circuitry. A decoder, in general, is a device which does the reverse of an
encoder, undoing the encoding so that the original information can be retrieved. The
same method used to encode is usually just reversed in order to decode.
33
Figure 4.1 − Block circuit of encoder
For example, the truth table of the encoder with 8 inputs and 3 outputs is shown
in figure 4.2.
34
when others => F<=”000”;
end case;
end process;
end arch;
35
when “10” =>D<=”0100”;
when “11” =>D<=”1000”;
when others => D<=”0000”;
end case;
end process;
end arch;
The famous examples of decoders like we already consider are binary n-to-2 n
decoders and seven-segment decoders. Let’s create the VHDL description of the last
one.
3.4.5 An example
You have to design the elevator controller in a building with X floors. For that
purpose you will use a binary code to represent each certain floor (N bits). The
number of 7-segment displays you have to choose according to N.
For example, if a building has X=5 floors, it means that numbers of bits,
required for representation of 5 floors, N=3 bits. Thus, we need only one 7-segment
display to represent numbers of floors from 1 to 5. But if we want to represent
numbers in the way “05”, then we need 2 displays (fig. 4.4).
Thus, in the capacity of a code converter you have to use a coder with N inputs
(according to your variant in binary system) and 14 outputs (if you need to use two 7-
segment displays) or 7 outputs (if you need to use only one 7-segment display).
The truth table for code converter when N=5 is shown in the table 4.1.
36
Table 4.1 − Truth table
Inputs Outputs of 7-segment display №2
A2 A1 A0 DD6 DD5 DD4 DD3 DD2 DD1 DD0
0 0 0 0 1 1 1 1 1 1
0 0 1 0 0 0 0 1 1 0
0 1 0 1 0 1 1 0 1 1
0 1 1 1 0 0 1 1 1 1
1 0 0 1 1 0 0 1 1 0
1 0 1 1 1 0 1 1 0 1
Using Karnaugh map for minimization of each output expression, we will get 7
expressions:
DD 6= A2 A1∨ A2 A1 ; DD 5= A1 A0∨A2 A1 ;
DD 4= A2 A0 ; DD 3= A2 A0∨ A2 A1∨A2 A1 A0 ;
DD 2= A1∨ A1∨A2 A0 ; DD 1=A2∨A2 A0 ;
DD 0=A2 A0∨A2 A1∨ A2 A1 A0 ;
The task will contain: a number of floors (X) and 2 variants of description
(using one of CSAs or one of behavioural operators). PICK UP VARIANTS OF
FLOOR’S NUMBERS and TYPE of DESCRIPTION FROM YOUR
SUPERVISOR!!!
Create projects of the device according to your variant using VHDL. Be
sure that you have obtained the truth table for the circuit according to you variant and
you have a minimal form of the final output expression. Do not forget to draw a
schematic.
Verify the VHDL models by programming them in Xilinx WebPack.
Check that your devices work as expected and compare them with the truth tables.
Verify each entry. If the VHDL models do not work properly, check and correct
them.
Don’t forget that before implementation you have to create implementation
constraints file (*.ucf) to identify which FPGA pins are used for your inputs and
outputs.
Record the results in your report.
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and outputs (block circuit), the VHDL model with comments
and the results of synthesis in WebPack software (RTL circuit).
37
1. What is the difference between encoder and decoder?
2. What is the difference between minterms or maxterms?
3. What does the term “BCD” mean?
4. What does the term “7-segment display” mean?
5. Write a behavioral code for the given block circuit using different types of
VHDL description.
The goal of this lab is to understand the usage of different operations for
describing the same functionality and to construct a structural VHDL model.
Before the work it is necessary to study theoretical material and lecture notes.
38
The design will be described in VHDL. Select Start→Programs→Xilinx
Design Tools →ISE Design Suite14.6 → ISE Design Tools→ ProjectNavigator.
All instructions you can find in the lab № 1.
5.3.4 The example of the combinational circuit design using structural type
of the description.
Here, we will work with synthesized combinational circuit (look at the scheme)
39
where each gate will be presented as a component with predefined behavior.
Thus, we have to redraw the combinational circuit using structural approach
(fig. 5.3).
Now we can create main program. It’s necessary to declare a component in that
VHDL-model where it will be used. Component declaration is placed in declarative
part of appropriate architecture.
In the following code you can see the component declaration of “NOT”-
element:
40
component not_el
port (x: in STD_LOGIC;
y: out STD_LOGIC);
end component;
41
begin el_1 … el_9 – labels for each
el_1: not_el port map (x=>A, y=>s1); component;
el_2: not_el port map (x=>B, y=>s2); not_el, or_el, and_el – names of
el_3: not_el port map (x=>C, y=>s3); component which coincide with
el_4: not_el port map (x=>D, y=>s4); names of theirs entity.
el_5: or_el port map (x1=>s1, x2=>s3, y=>s5);
In the all port maps for each input-
el_6: or_el port map (x1=>s2, x2=>s4, y=>s6);
output port you have to describe
el_7: and_el port map (x1=>s5, x2=>s4,
y=>s7); explicitly theirs connection with
el_8: and_el port map (x1=>s6, x2=>s3, internal signals.
y=>s8);
el_9: or_el port map (x1=>s7, x2=>s8, y=>F);
end arch;
For example, for first element: el_1: not_el port map (x=>A, y=>s1);
el_1 – label;
not_el – name of the entity of “not” component;
x=>A – according to the fig. 3 we connected input x of “not” element with global
input A of combinational circuit;
y=>s1 – according to the fig. 5.3 we connect output x of “not” element with internal
signal s1 of combinational circuit;
The number of your variant pick up according to the serial number in your
register (table 5.1). For given variant of function write its DNF, minimize it by
Carnaugh map and write its bracket multiplication form. The result of these actions is
minimized Boolean equation.
42
Execute combinational circuit synthesis from minimized Boolean equation.
Create a model of synthesized combinational circuit in a form of Structural
description.
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and outputs (logic circuit), the VHDL model with comments
and the results of synthesis in WebPack software (RTL circuit).
43
6 SIMULATION OF LATCHES/FLIP-FLOPS
Before the work it is necessary to study theoretical material and lecture notes.
44
falling edge). However, after the rising or falling edge of the enable signal, and
during the time when the enable signal is at a constant 1 or 0, the flip-flop’s state
remains constant even if the input changes. In a microprocessor system, we usually
want changes to occur at precisely the same moment. Hence, flip-flops are used more
often than latches, since they can all be synchronized to change only at the active
edge of the enable signal. This enable signal for the flip-flops is usually the global
controlling clock signal. Historically, there are basically four main types of flip-flops:
SR, D, JK, and T. The major differences between them are the number of inputs they
have and how their contents change. Any given sequential circuit can be built using
any of these types of flip-flops (or combinations of them). However, selecting one
type of flip-flop over another type to use in a particular sequential circuit can affect
the overall size of the circuit.
Today, sequential circuits are designed mainly with D flip-flops because of
their ease of use. This is simply a tradeoff issue between ease of circuit design versus
circuit size. Thus, we will focus mainly on the D flip-flop.
Latches are known as level-sensitive because their outputs are affected by their
inputs as long as they are enabled. Their memory state can change during this entire
time when the enable signal is asserted.
D latch. Qnext always gets the same value as the input D, and is independent of
the current value of Q. Hence, we obtain the truth table for the D latch, as shown in
figure 6.1(b).
D latch with enable. The circuit for the D latch with enable (also known as a
gated D latch) is shown in Figure 6.2 (a). The external input becomes the new D
input, the output of the multiplexer is connected to the original D input, and the select
line of the multiplexer is the enable signal E.
45
When the enable signal E is asserted (E = 1), the external D input passes
through the multiplexer, and so Q next (i.e., the output Q) follows the D input. On the
other hand, when E is de-asserted (E = 0), the current value of Q loops back as the
input to the circuit, and so Q next retains its last value independent of the D input.
When the latch is enabled, the latch is said to be open, and the path from the input D
to the output Q is transparent. In other words, Q follows D. Because of this
characteristic, the D latch with enable circuit is often referred to as a transparent
latch. When the latch is disabled, it is closed, and the latch remembers its current
state.
The truth table and the logic symbol for the D latch with enable are shown in
Figure 6.2 (b) and (c). A sample trace for the operation of the D latch with enable is
shown in Figure 6.2 (d). Between t0 and t1, the latch is enabled with E = 1, so the
output Q follows the input D. Between t1 and t2, the latch is disabled, so Q remains
stable even when D changes.
46
This edge signal is referred to as the active edge of the clock. In all of our examples,
we will use the rising clock edge as the active edge. Therefore, at every rising edge,
data will be clocked or stored into the memory element.
A clock cycle is the time from one rising edge to the next rising edge or from
one falling edge to the next falling edge. The speed of the clock, measured in hertz
(Hz), is the number of cycles per second.
The speed of the clock is determined by how fast a circuit can produce valid
results.
D Flip-Flop. Unlike the latch, a flip-flop is not level-sensitive, but rather edge-
triggered. In other words, data gets stored into a flip-flop only at the active edge of
the clock. An edge-triggered D flip-flop achieves this by combining in series a pair
of D latches. Figure 6.4 (a) shows a positive-edge-triggered D flip-flop, where two
D latches are connected in series. A clock signal Clk is connected to the E input of
the two latches: one directly, and one through an inverter.
The first latch is called the master latch. The master latch is enabled when Clk
= 0 because of the inverter, and so QM follows the primary input D. However, the
signal at QM cannot pass over to the primary output Q, because the second latch
(called the slave latch) is disabled when Clk = 0. When Clk = 1, the master latch is
disabled, but the slave latch is enabled so that the output from the master latch, QM,
is transferred to the primary output Q. The slave latch is enabled all the while that
Clk = 1, but its content changes only at the rising edge of the clock, because once Clk
is 1, the master latch is disabled, and the input to the slave latch, QM, will be
constant. Therefore, when Clk = 1 and the slave latch is enabled, the primary output
Q will not change because the input QM is not changing.
The circuit shown in Figure 6.4 (a) is called a positive-edge-triggered D flip-
flop because the primary output Q on the slave latch changes only at the rising edge
of the clock. If the slave latch is enabled when the clock is low (i.e., with the inverter
output connected to the E of the slave latch), then it is referred to as a negative-
edgetriggered flip-flop. The circuit is also referred to as a master-slave D flip-flop
because of the two D latches used in the circuit.
Figure 6.4 (b) shows the operation table for the D flip-flop. The symbol ↑
signifies the rising edge of the clock. When Clk is either at 0 or 1, the flip-flop retains
its current value (i.e., Q next = Q). Q next changes and follows the primary input D only
at the rising edge of the clock. The logic symbol for the positive-edge-triggered D
flip-flop is shown in Figure 6.4 (c). The small triangle at the clock input indicates that
the circuit is triggered by the edge of the signal, and so it is a flip-flop. Without the
47
small triangle, the symbol would be that for a latch. If there is a circle in front of the
clock line, then the flip-flop is triggered by the falling edge of the clock, making it a
negative-edgetriggered flip-flop. Figure 6.4 (d) shows a sample trace for the D flip-
flop. Notice that when Clk = 0, QM follows D, and the output of the slave latch, Q,
remains constant. On the other hand, when Clk = 1, Q follows QM, and the output of
the master latch, QM, remains constant.
48
Figure 6.5 – D flip-flop with enable
VHDL does not have any explicit object for defining a memory element.
Instead, the semantics of the language provide for signals to be interpreted as a
memory element. In other words, the memory element is declared depending on how
these signals are assigned. Consider the different types of VHDL description of
different triggers (fig. 6.6, 6.7, 6.8).
library IEEE; library IEEE;
use IEEE.std_logic_1164.all; use IEEE.std_logic_1164.all;
entity d_latch_en is
entity rs_latch is port(enable, D: in std_logic;
port(R, S: in std_logic; Q :out std_logic);
Q, nQ :inout std_logic); end d_latch_en;
end rs_latch; architecture beh of d_latch_en is
begin
architecture Beh of rs_latch is process (enable, D)
begin begin
Q<=R nor nQ; if (enable = '1') then Q <= D;
nQ<=S nor Q; end if;
end Beh; end process;
end beh;
Figure 6.6 – RS-latch Figure 6.7 –D latch with enable
(data flow model) (behavioural model)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux is
port(x1,x2,x3: in std_logic; y :out std_logic);
end mux;
architecture Beh of mux is begin
process (x1,x2,x3) begin
if (x3='0') then y<=x1;
else y<=x2;
end if;
49
end process;
end Beh;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff is
port(dd, clk: in std_logic; qq :out std_logic);
end dff;
architecture Beh of dff is begin
process (clk,dd) begin
if (clk'event and clk='1') then qq<=dd;
end if;
end process;
end Beh;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff_en is
port(E, D, CLK: in std_logic; Q :inout std_logic);
end dff_en;
architecture Behavioral of dff_en is
component mux is
port(x1,x2,x3: in std_logic; y :out std_logic);
end component;
component dff is
port(dd, clk: in std_logic; qq :out std_logic);
end component;
signal s1:std_logic;
begin
el_1: mux port map(x1=>Q,x2=>D,x3=>E,y=>s1);
el_2: dff port map(dd=>s1, clk=>CLK, qq=>Q);
end Behavioral;
Figure 6.8 –D flip-flop with enable
(structural model)
50
2. Check your Project Options (figure 6.9) (double click on your project
xc3s500e-5fg320 in the Source window):
4. Create a new file with Test Bench Waveform, save it with the name *_tbw
(fig. 6.11). It will create a new waveform, where you can set you input stimuli by
hand.
51
Figure 6.11 – New source wizard
Check the information about this new file. If correct, click Finish.
5. After creating the file, you will see the option of inputs types choosing (fig.
6.12). Be careful to choose the right type, and chose the delay. Delays are necessary
for offsetting the time, when you will see the results and the time, when new inputs
will be set.
6. After finishing, you will see the window with prepared timing scale (fig.
6.13).
52
Figure 6.13 – Timing diagram
You should assign input waveforms ONLY for inputs. Outputs are calculated
automatically. The blue shaded areas that proceed correspond to the Input Setup
Time. Toggle inputs variable to define the input stimulus for the design as follows:
click on the blue cell at 10 ns (for example) to assert first input high ('1'). Then click
on the blue cell at approximately the 20 ns (for example) to assert first input low
('0'). Time you can choose what you want. Repeat this operation for all input signals.
You will get such picture (fig. 6.14).
7. Change the tab bottom of the project to Process and Source, like on picture
(fig. 6.15).
53
8. Choose the Testbench Waveform source file. You should see the option of
Model Simulation under Xilinx ISE Simulator Property. Press on Simulate
Behavioral Model (fig. 6.16).
9. After finishing simulation, you will see the result of output calculation,
Analyze the results in correspondence to the given inputs (fig. 6.17). For example,
54
NOTE: Starting in 11.1, Xilinx® will no longer support the Test Bench
Waveform Editor. When a project with a test bench waveform (TBW) is upgraded
to 11.1- 14.6, the TBW will be automatically converted to an HDL test bench and
added to the project. Xilinx recommends using HDL test benches for new projects.
The number of your variant pick up according to the serial number in your
register (table 6.1).
For your type of sequential circuit create transition table (truth table) and
do not forget to draw schematic.
Synthesize your project and check the RTL schematic. If your circuit what
you draw before doesn't match with RTL circuit, try to correct your VHDL-model!
Verify the VHDL models by simulating them on all possible modes in
Xilinx WebPack. Check that your VHDL model works as expected and compare it
with the truth table given in the pre-lab. Verify each entry. If the VHDL model does
not work properly, check and correct it. When you modify any VHDL file, you
should update the simulator.
Record the waveforms. You can capture a screen of the waveforms and
save them as a file for insertion in your report.
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and outputs (block circuit), the VHDL model with
55
comments, the results of synthesis in WebPack software (RTL circuit) and the result
of the simulation.
The goal of this lab is to understand the operation and control of a shifter which
based on trigger, to learn the procedure of behavioral and structural VHDL
description and to develop VHDL model of a n-bit shifter.
Before the work it is necessary to study theoretical material and lecture notes.
56
7.3.2 Design entry
57
data : in STD_LOGIC; Q :out STD_LOGIC);
reset : in STD_LOGIC; end D_tr;
Q1,Q2,Q3,Q4 : out architecture behav of D_tr is
STD_LOGIC); begin
end reg1; process (clk, reset) begin
if (reset ='0' ) then Q<='0';
architecture reg1_arch of reg1 is elsif (clk'event and clk = '1') then Q<= D;
signal sq1,sq2,sq3,sq4: STD_LOGIC; end if;
begin end process;
process (Clk, reset) is end behav;
begin
if ( reset = '0' ) then
sq1 <='0'; sq2<='0'; sq3<='0'; sq4<='0'; library IEEE;
elsif (rising_edge(Clk)) then use IEEE.std_logic_1164.all;
sq1<=data; entity registr is
sq2<=sq1; port (CLK : in STD_LOGIC;
sq3<=sq2; DATA : in STD_LOGIC;
sq4<=sq3; RESET : in STD_LOGIC;
end if; Q1,Q2,Q3,Q4 : out STD_LOGIC);
Q1<=sq1; end registr;
Q2<=sq2;
Q3<=sq3; architecture registr_arch of registr is
Q4<=sq4;
component D_tr
end process; port (D,clk,reset :in STD_LOGIC;
end reg1_arch; Q :out STD_LOGIC);
end component;
begin
tr1:D_tr port map (D=>DATA, clk=>CLK,
reset=>RESET, Q=>sq1);
tr2:D_tr port map (D=>sq1, clk=>CLK,
reset=>RESET, Q=>sq2);
tr3:D_tr port map (D=>sq2, clk=>CLK,
reset=>RESET, Q=>sq3);
tr4:D_tr port map (D=>sq3, clk=>CLK,
reset=>RESET, Q=>sq4);
Q1<=sq1;
Q2<=sq2;
Q3<=sq3;
Q4<=sq4;
end registr_arch;
58
Figure 7.2 – The waveform of the shift register
The number of your variant pick up according to the serial number in your
register (table 7.2). The task will contain: type of the circuit – multiplexer
(demultiplexer) and variants of the VHDL description.
59
Generator Similarly to the shift register in Figure 1,
"running 0 " but the output Q4 is connected to the input
6. on the D-flip- data of the first discharge (DATA). The 4 bit behavioral
flops first trigger sets to "0" when reset=0 , and
all another triggers sets to "1".
Generator Similarly to the shift register in Figure 1,
"checkerboard but the output Q4 is connected to the input
7. " on the D- data of the first discharge (DATA).The 4 bit behavioral
flip-flops even triggers sets to "0" when reset=0 , and
the odd triggers sets to "1" when reset=0.
Johnson Similarly to the shift register in Figure 1,
counter but the inverting output Q4 is connected
( generator of to the input data of the first discharge
8. 4 bit Behavioral
adjacent code (DATA). The first trigger sets to "1" when
on the D-flip- reset=0 , and all another triggers sets to
flops) "0".
Generator Similarly to the shift register in Figure 1,
"running 1" but the output Q4 is connected to the input
9. on the D-flip- data of the first discharge (DATA). The 4 bit structural
flops first trigger sets to "1" when reset=0 , and
all another triggers sets to "0".
Generator Similarly to the shift register in Figure 1,
"running 0 " but the output Q4 is connected to the input
10. on the D-flip- data of the first discharge (DATA). The 4 bit structural
flops first trigger sets to "0" when reset=0 , and
all another triggers sets to "1".
Generator Similarly to the shift register in Figure 1,
"checkerboard but the output Q4 is connected to the input
11. " on the D- data of the first discharge (DATA).The 4 bit structural
flip-flops even triggers sets to "0" when reset=0 , and
the odd triggers sets to "1" when reset=0.
Johnson Similarly to the shift register in Figure 1,
counter but the inverting output Q4 is connected
( generator of to the input data of the first discharge
12. 4 bit structural
adjacent code (DATA). The first trigger sets to "1" when
on the D-flip- reset=0 , and all another triggers sets to
flops) "0".
For your type of sequential circuit create truth table; Do not forget to draw
schematics.
Synthesize your project and check the RTL schematic. If your circuit
what you draw before doesn't match with RTL circuit, try to correct your VHDL-
model!
Verify the VHDL models by simulating them on all possible modes in
Xilinx WebPack. Check that your VHDL model works as expected and compare it
with the truth table given in the pre-lab. Verify each entry. If the VHDL model does
60
not work properly, check and correct it. When you modify any VHDL file, you
should update the simulator.
Record the waveforms. You can capture a screen of the waveforms and
save them as a file for insertion in your report.
The report has to contain the individual task, the truth table, the Carnaugh map,
the interface with inputs and outputs (block circuit), the VHDL model with
comments, the results of synthesis in WebPack software (RTL circuit) and the result
of the simulation.
The goal of this lab is to understand the operation of a finite state machine, to
learn the development of a finite state machine, to experimentally check the VHDL
model.
Before the work it is necessary to study theoretical material and lecture notes.
61
In addition to their use in modeling reactive systems presented here, finite state
automata are significant in many different areas, including electrical engineering,
linguistics, computer science, philosophy, biology, mathematics, and logic.
There are two different groups: Acceptors/Recognizers and Transducers.
Acceptors and recognizers (also sequence detectors) produce a binary output, saying
either yes or no to answer whether the input is accepted by the machine or not. All
states of the FSM are said to be either accepting or not accepting. At the time when
all input is processed, if the current state is an accepting state, the input is accepted;
otherwise it is rejected.
Here is a structural model of the automaton (fig. 8.1).
62
state diagram or state table as the first step of the design procedure. In this section, an
example illustrates the construction of a state diagram for a circuit.
This sequence-recognizing circuit is to have one input X and one output Z. In
addition, it has direct resets on its flip-flops to initialize the state of the circuit to all
zeros. The circuit is to recognize the occurrence of the sequence of bits “1000” on X
by making Z equal to ‘1’ when the previous three inputs to the circuit were “100” and
current input is ‘0’. Otherwise, Z equals ‘0’. The circuit should distinguish the
necessary sequence wherever it occurs in a longer one.
The formulation of any state diagram should allow recognizing the necessary
sequence. It means that there should be states to "remember" something about the
history of past inputs. For the sequence “1000” in order to be able to produce the
output value 1 coincident with the final ‘0’ in the sequence, the circuit must be in a
state that "remembers" that the previous three inputs were “100”. With this concept
in mind, we begin to formulate the state diagram by defining an arbitrary state – say,
A – as the state in which none of the first portion of the sequence to be recognized
has occurred. If ‘1’ occurs on the input, since ‘1’ is the first bit in the sequence, the
event must be "remembered," and the state after the clock pulse cannot be A. So, a
second state B is established to represent the occurrence of the first ‘1’ in the
sequence. Further, to represent the occurrence of the first ‘1’ in the sequence, a
transition is placed from A to B labeled with ‘1’. Since this is not the end of the
sequence “1000”, its output is ‘0’. This initial portion of the state diagram is given in
Figure 8.3 (a).
1/0
A B
(a)
1/0 0/0
A B C
(b)
1/0 0/0 0/0
A B C D
(c)
(d)
63
(e)
Figure 8.3 – Finding a state diagram for a sequence recognizer
The next bit of the sequence is ‘0’. When this ‘0’ occurs in the state B, a state
is needed to represent the occurrence of a 1 and a 0 in a row at the input. So, a state C
and the associated transition are added, as shown in Figure 8.3 (b). The next bit of the
sequence is ‘0’. When this ‘0’ occurs in the state C, a state is needed to represent the
occurrence of ‘1’ and ‘0’ in a row followed by ‘0’. So, the state D with a transition
having a 0 input and 0 output is added (Figure 8.3 (c)). Since state D represents the
occurrence of “100” as the previous three input bit values, we need the state E to
recognize the last ‘0’ in an input row. Now we are ready to produce the output ‘1’,
because recognizing is completed.
We need five states, since last ‘0’ input cannot be the first bit in the sequence
to be recognized, so we cannot come back to the state A from the state D directly.
In Figure 8.3 (c), all transitions are specified for each state for only one of the
two possible input values. Consider the state A with the ‘0’ input as the first bit in the
sequence. If it is so, we should wait for the input ‘1’. So, we stay in the state A.
Consider the state B. We have already used the transition with ‘0’ as the input.
If we have ‘1’ as the input, this ‘1’ can be the first ‘1’ in the sequence. So, we should
stay in the state B and wait for the next input ‘0’.
Consider the state C. If we have ‘1’ as the input, the current sequence is
canceled and this 1 can be the first in the next recognizing sequence. So, we return to
the state B and wait for the next ‘0’.
The same situation is with the input 1 in the state D. Note that in all considered
transitions the circuit output equals to ‘0’.
Let’s look at the state E. If we are in this state, it means that the current
sequence is already recognized. If the input is ‘1’, then we go to the state B to wait
for the next ‘0’. If the input is ‘0’, then we go to the state A to wait for the first ‘1’ in
the sequence.
Important to note that output in the state E is set to ‘1’, regardless what the next
input will be.
64
The resulting partial state diagram, which completely represents the occurrence
of the sequence to be recognized, is shown in Figure 8.3 (d).
According to the state diagram, we can complete a state table (table 8.1).
entity state_machine is
port(reset, clk, x : in std_logic; z : out std_logic); -- input and output signals
end state_machine;
65
next_state_process: process (state, x) is -- process to evaluate next state
begin
case state is
when A => if x = '0' then next_state <= A;
elsif x = '1' then next_state <= B; end if;
when B => if x = '0' then next_state <= C;
elsif x = '1' then next_state <= B; end if;
when C => if x = '0' then next_state <= D;
elsif x = '1' then next_state <= B; end if;
when D => if x= '0' then next_state <= E;
elsif x = '1' then next_state <= B; end if;
when E => if x= '0' then next_state <= A;
elsif x = '1' then next_state <= B; end if;
end case; end process next_state_process;
66
and the output are correct. In addition, at the end of the sequence, the master-reset R
is used to reset flip-flops in the circuit from 1 to 0. The sequence, shown in figure 8.3
(a), applies the values listed for R and X at successive clock cycles. The respective
states and output values, as determined from the state diagram, are also shown.
That’s why after first try of simulation you have to repeat the following actions
(fig. 8.5).
67
Don’t forget to SAVE ALL ( ). After that you have to repeat the
simulation as shown on the picture (fig. 8.6).
During the simulation you can see the following message (figure 8.7).
Press yes and simulation will continue. The final result you have to analyze and
compare with state table or with state diagram (figure 8.8).
68
Figure 8.8 − A trace of the operation of the state machine
The number of your variant pick up according to the serial number in your
register (table 8.2).
69
8.4 Contents of the report
The report has to contain the individual task, the state, the state diagram, the
VHDL model with comments and the results simulation.
The goal of this lab is to become familiar with different codes and to learn the
description of such combinational circuit in VHDL.
Before the work it is necessary to study theoretical material and lecture notes.
70
The availability of a large variety of codes for the same discrete elements of
information results in the use of different codes by different digital systems. It is
some time necessary to use the output of one system as the input to the other. The
conversion circuit must be inserted between the two systems if each uses different
codes for the same information. Thus a code converter is a circuit that makes the two
systems compatible even though each uses the different code.
For each output (y1, y2, y3, y4) let’s create a Carnaugh map (fig. 9.2).
71
Figure 9.2 − Carnaugh map
After minimization we will get the minimal DNF (sum of products, SOP) for
each output:
y1= x1 x3 x4∨x1 x2∨x1 x2x4∨ x1 x2x3 ;
y2=x2 x3 x4∨x2 x4∨ x2 x3 ;
y3= x3 x4∨x3x4 ;
y4=x4 ;
Now we can draw the combinational circuit (fig. 9.3).
You can see the following VHDL template for our design:
72
Library IEEE;
use IEEE.std_logic_1164.all;
entity converter is
port ( x1,x2,x3,x4: in STD_LOGIC;
y1,y2,y3,y4: out STD_LOGIC );
end converter;
architecture beh of converter is
begin
y1 <= ((not x1) and (not x3) and (not x4)) or (x1 and (not x2)) or ((not x1) and
x4) or ((not x1) and x2 and x3);
y2 <= (x2 and (not x3) and (not x4)) or ( (not x2) and x4 ) or ((not x2) and x3);
y3 <= ( (not x3) and (not x4)) or (x3 and x4) ;
y4 <= x4;
end beh;
The number of your variant pick up according to the serial number in your
register (table 9.1).
73
The report has to contain the individual task, the truth table, the Carnaugh map,
the VHDL model with comments and the results of synthesis in WebPack software
(RTL circuit).
REFERENCES
74
Educational edition
GUIDELINES
Надруковано в навчально-науковому
видавничо-поліграфічному центрі ХНУРЕ
61166 Харків, просп. Леніна, 14