0% found this document useful (0 votes)
16 views

Lab 5

Uploaded by

nhiphan4303
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lab 5

Uploaded by

nhiphan4303
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Laboratory 5 (100 Points)

Assignment 1 (10 Points)


Design a logic diagram to implement 2-4 decoder with Enable pin (using buses for grouping lines in the
same group)
1. Derive the decoder’s truth table.
2. Design the logic diagram to implement the 2-4 decoder.
3. Simulate the circuit and check the result with the truth table.

1. Truth table

EN A1 A0 D0 D1 D2 D3
0 x x 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1

2. Design the 2-4 decoder’s logic diagram


Lines A1, A0: Bus A[1..0]
Lines D3, D2, D1, D0: Bus D[3..0]

3. Simulate the circuit


Assignment 2 (10 Points)
Create a 128-bit RAM organized as 32-word by 4-bit array.

1. Create the 32-4 RAM (32 by 4)


- Name the RAM as RAM32_4:

- The MegaWizard Plug-In Manager window is shown as in the following screen.


Notice that the ‘q’ output port as well
as all of the input ports are registered.
This means that any data at these
ports will be read in on the next rising
edge of the clock.
We can initialize the memory
contents of the RAM later.
You should now see the symbol for the RAM we just created. Click Yes and place the RAM in your
design.

2. Use the RAM32_4

3. We now initialize the memory contents of our RAM.

We will use a Memory Initialization File (.MIF). Select File > New from the menu and then select
Memory Initialization File. Click OK.
Select 16 words and 4 bit word size to match our RAM block.

You can now fill the memory with any values from 0 to 15 (15 is the maximum because our word size is 4
bits).
Right clicking on a cell or range of cells will allow us to rapidly fill multiple memory addresses
with custom values.
Remember to save the .imf file. The file name should default to RAM32_4_test.mif

Now we must update our RAM to initialize itself to our memory initialization file. Right click the RAM
component in the schematic and select IP Parameter Editor.
Click Next until you reach the Mem Init tab (or just click the Mem Init tab). Select Yes, use this file for
the memory content data to specify a file and then select browse and find your .mif file.
Select the file and then click Finish.
Compile the design

During compilation if you get the error message:


"16031 Current Internal Configuration mode does not support memory initialization or ROM.
Select Internal Configuration mode with ERAM.",

Select Assignments -> Device -> Device and Pin Options -> Configuration -> Configuration
Mode: Single uncompressed image with Memory Initialization
Recompile the project again.

4. Simulate the circuit


- Create the clock signal for the clock line:
+ Select the clock line and select Overwrite Clock.
We can determine the Period, Offset and Duty cycle of the clock signal.
You should see that the q output matches the data values we stored in the RAM using our memory
initialization file.
Notice that the output is updated on the second rising edge of the clock after a new address is
presented to the RAM. This is because we selected to register both the input and output ports of our
RAM in the MegaWizard Plug-In Manager. On the first rising edge, the RAM receives whatever address is
presented at the address pins. The RAM reads the data value and presents it to the output port, but the
data at the output port is not presented to the q pins until the next rising clock edge.

Assignment 3 (10 Points)


Design a logic diagram to implement 3-8 decoder with an enable input.
1. Derive the decoder’s truth table.
2. Design the logic diagram to implement the decoder.
3. Simulate the circuit and check the result with the truth table.

Assignment 4 (10 Points)


Design a logic diagram to implement 1-bit 8-1 multiplexer.
1. Design the logic diagram to implement the multiplexer.
2. Simulate the circuit and check the result.

Assignment 5 (10 Points)


Design a logic diagram to implement 8-bit 8-1 multiplexer.
1. Design the logic diagram to implement the multiplexer.
2. Simulate the circuit and check the result.
Assignment 6 (20 Points)
Design a logic diagram to implement an 8-bit parallel load register with enable input.
1. Design the logic diagram of the register.
2. Simulate the circuit and check the result.

Assignment 7 (10 Points)


Design a logic diagram of a 32 x 8 RAM using two 32 x 4 RAM chips.
1. Design the logic diagram.
2. Simulate the circuit and check the result.

Assignment 8 (20 Points)


Design a logic diagram of a 64 x 4 RAM using two 32 x 4 RAM chips.
1. Design the logic diagram.
2. Simulate the circuit and check the result.

You might also like