Kuw 103650
Kuw 103650
Kuw 103650
1. Introduction
In this experiment, you will get introduced to the implementation of Read-Only Memory (ROM) in Altera
Cyclone IV E FPGA and the operation of 7-Segment LED display.
2. Objectives
By the end of this lab experiment, students will:
Be familiar with the concept of data storage.
Learn how to use Memory.
Be able to use ROM to implement Multiple-Output circuit.
Practice testing their designs by simulation and downloading on the Cyclone IV E FPGA on Altera
DE2-115 board.
ROM does not have data input lines because it does not have a write operation.
Integrated circuit ROM chips have one or more enable input(s) and sometimes come with three-
state outputs to facilitate the construction of large arrays of ROM.
ROM can also be used to implement a k-inputs, n-outputs truth table or function, with no
specific relation between the number of inputs and the number of outputs.
A push button (pb) is a simple switch mechanism that requires a spring to return to its un-pushed state,
as it is prone to bouncing. When a push button is connected in a circuit to pass on logic ’1’ / logic ’0’, due
to bouncing effect, instead of passing one pulse, several clock pulses are passed, which in turn will alter
the output. By using a counter to measure an appropriately long delay to wait for the bouncing to stop
(LFC), the on-board clock on the Altera DE2-115 Board is modified by LFC, as shown in Figure 4, so that
the switch is read only once for every press.
Modify the custom megafunction ROM in Quartus II Software Library to store the truth table of a 7-
Segment Display Selector Circuit. The circuit accepts a 3-bit number and displays the specified character
as per Table 1 on any of the CA type 7-Segment Displays available on Altera DE2-115 Board.
I2 I1 I0 Display
0 0 0 2
0 0 1 5
0 1 0 4
0 1 1 7
1 0 0 6
1 0 1 A
1 1 0 C
1 1 1 L
4. Design Procedure
The design of any combinational circuit always starts with problem definition, which is solved by
designing appropriate logic circuit. The procedure involves the following steps:
Outputs
Inputs Character on a 7-
a/0 b/1 c/2 d/3 e/4 f/5 g/6 dp/NA
Segment Display
I2 I1 I0 D1 D2 D3 D4 D5 D6 D7 D8
0 0 0 2 0 0 1 0 0 1 0 1
0 0 1 5
0 1 0 4
0 1 1 7
1 0 0 6
1 0 1 A
1 1 0 C
1 1 1 L
3. Click in any empty space in lab5.bdf file to place the new ROM symbol.
4. Right-Click on the ROM symbol → select Properties.
5. In the Parameter Tab, fill in the following information (as in Figure 7):
LPM_ADDRESS_CONTROL:
o Checks if the address and control ports should be registered?
o select “REGISTERED”
LPM_FILE:
o Requests for the name of file that contains the initial contents of memory array
(*.mif file)
o Type in “rom8.mif” (Note: The *.mif file name should be types between Double
Quotes, as in exactly “rom8.mif” )
LPM_NUMWORDS:
o Requests for the number of memory words, which is the number of rows in the
truth table or 2(number of address lines), default is 2^LPM_WIDTHAD
o In our example 8 Type 8
LPM_OUTDATA:
o Checks if the output data should be registered?
o Leave it as “UNREGISTERED”
LPM_WIDTH:
o Requests for the data width in bits, any integer > 0
o In our example 8 Type 8
LPM_WIDTHAD:
o Requests for number of address lines, any integer > 0
o In our example 3 Type 3
6. In the Ports Tab, Double-Click on the “Used” Word under the Status Column to change it to
“Unused”, for memenab and outclock ONLY. The others (address, inclock, q) should be kept as
“Used” (as in Figure 8).
7. Click on Ok.
Figure 8: Ports Tab
8. In the ROM symbol, input and output lines will be thick indicating it is a bus.
9. Take care to drag the lines from the ROM symbol towards the input/output ports so that thick
line continues.
10. Name the input ports as I[2..0] and Clock.
11. Name the output port as D[1..8] as in Figure 9.
12. Click on Save.
Step 7: Simulation
1. Analyze and 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).
3. Make sure grouped signals in the waveform are in the same order as they appear in the Table 2
(I2, I1, I0, D1 to D8). You can verify for every input condition (I2 I1 I0) on a row, the
corresponding output (D1 to D8) of Table 2 must match with the simulation waveform.
Step 8: Fit and Program Cyclone IV E FPGA on Altera DE2-115 Board
1. You need to add the LFC symbol, which will provide control over the Clock signal using a Push
Button (PB).
2. Your instructor will provide you with the LFC symbol, or LFC Verilog code, for which you will
have to create a symbol (refer to Section 3.5 in Lab Session#1).
3. Place the LFC symbol in the same Block Diagram/Schematic file where you have the ROM design.
4. Connect the Clock through LFC circuit as shown in Figure 10.
5. Save your new design with a different name. Note that you cannot use the new design (with the
LFC symbol) to perform functional simulation. The LFC symbol is added only when downloading
your design to Altera DE2-115 Board.
6. Analyze and synthesize your design for the implemented circuit (refer to Section 3.2.5 in Lab
Session#1).
7. Compile your design.
8. Using the pin assignment datasheet assign the pins for switches and 7-Segment Display (HEX7).
9. Fit, Analyze and download the design into Cyclone IV E FPGA on Altera DE2-115 Board.
10. Compile your design AGAIN.
11. Program and configure the FPGA to test the implemented design physically using switches and
LEDs.
12. Test your downloaded design. For every switch condition given in Table 1, the corresponding
character should appear on the 7-Segment Display.
Student Name: Date:
Student ID:
Lab Exercise # 4
Problem Statement:
Implement the Problem Statement illustrated in the experiment description.
Procedure:
1. If a table that has 12 rows and 10 columns is to be implemented in a ROM. Answer the following
questions:
a. How many input bits are required ? ……..……………..
d. What is the end time required in the Functional simulation waveform to test your design ?
……..……………..
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.