Docsity

Lab Report: Building and Testing a Decoder Circuit - Prof. R. Lysecky, Lab Reports of Electrical and Electronics Engineering

Toggle sidebar
bg1
Lab 2: Decoder
In this lab, you will build a special type of circuit called a decoder. The block diagram is shown in Figure
1(a). The decoder has 3 inputs: in0, in1, in2, and 8 outputs: out0, out1, out2, out3, out4, out5,
out6, and out7.
Based on the input values only one output will be set to 1 with the remaining outputs set to 0. Figure 1(b)
shows the corresponding truth table indicating which input combinations set which output to 1. For
example, the first row in the truth table indicates that if the input to the decoder is in0=0, in1=0, and
in2=0, then out0=1 and the remaining outputs are set to 0 (out1=0, out2=0, out3=0, out4=0,
out5=0, out6=0, out7=0). If instead the input to the decoder is in0=0, in1=1, and in2=1, then
the fourth row of the truth table indicates output out3=1 and the remaining outputs are set to 0 (out0=0,
out1=0, out2=0, out4=0, out5=0, out6=0, out7=0).
Lab Procedure:
1. Implement the decoder behaviorally, following the specifications provided in Figure 1.
2. Test your design exhaustively simulating all possible combinations.
3. Download your decoder to the Spartan-3E Starter board. Test your design exhaustively trying all
possible combinations.
Demo:
You must demo the following aspects to the TA:
1. Verilog code for the decoder.
2. Simulation waveforms demonstrating correct functionality of the decoder for all possible inputs.
3. Synthesis of the decoder to Spartan 3E Starter Board demonstrating correct functionality for all
possible inputs.
Lab Report
In addition to the standard lab report format, you must submit the following information:
1. Verilog code for the decoder and the corresponding testbench code.
2. Simulation waveforms demonstrating correct functionality of the decoder for all possible inputs.
Figure 1: Decoder (a) block diagram and (b) truth table
Decoder
in0
in1
in2
out0
out1
out2
out3
out4
out5
out6
out7
in2 in1 in0 F
0 0 0 out0
0 0 1 out1
0 1 0 out2
0 1 1 out3
1 0 0 out4
1 0 1 out5
1 1 0 out6
1 1 1 out7
(a) (b)
pf2

Partial preview of the text

Download Lab Report: Building and Testing a Decoder Circuit - Prof. R. Lysecky and more Lab Reports Electrical and Electronics Engineering in PDF only on Docsity!

Lab 2: Decoder

In this lab, you will build a special type of circuit called a decoder. The block diagram is shown in Figure 1(a). The decoder has 3 inputs: in0, in1, in2, and 8 outputs: out0, out1, out2, out3, out4, out5, out6, and out7.

Based on the input values only one output will be set to 1 with the remaining outputs set to 0. Figure 1(b) shows the corresponding truth table indicating which input combinations set which output to 1. For example, the first row in the truth table indicates that if the input to the decoder is in0=0, in1=0, and in2=0, then out0=1 and the remaining outputs are set to 0 (out1=0, out2=0, out3=0, out4=0, out5=0, out6=0, out7=0). If instead the input to the decoder is in0=0, in1=1, and in2=1, then the fourth row of the truth table indicates output out3=1 and the remaining outputs are set to 0 (out0=0, out1=0, out2=0, out4=0, out5=0, out6=0, out7=0).

Lab Procedure:

  1. Implement the decoder behaviorally , following the specifications provided in Figure 1.
  2. Test your design exhaustively simulating all possible combinations.
  3. Download your decoder to the Spartan-3E Starter board. Test your design exhaustively trying all possible combinations.

Demo:

You must demo the following aspects to the TA:

  1. Verilog code for the decoder.
  2. Simulation waveforms demonstrating correct functionality of the decoder for all possible inputs.
  3. Synthesis of the decoder to Spartan 3E Starter Board demonstrating correct functionality for all possible inputs.

Lab Report

In addition to the standard lab report format, you must submit the following information:

  1. Verilog code for the decoder and the corresponding testbench code.
  2. Simulation waveforms demonstrating correct functionality of the decoder for all possible inputs.

Figure 1: Decoder (a) block diagram and (b) truth table

Decoder

in in in

out out out out out out out out

in2 in1 in0 F 0 0 0 out 0 0 1 out 0 1 0 out 0 1 1 out 1 0 0 out 1 0 1 out 1 1 0 out 1 1 1 out

(a) (b)

Mapping your decoder to the Spartan 3E Starter Board

In order to download your decoder to the Spartan board we must map the input and output signals of our decoder to components found on the Spartan 3E Starter Board. For this project we will map our input signals to the slide switches and our output signals to LEDs. You will need to specify your .ucf file as follows:

This .ucf file will map your inputs and output to the board as follows:

The slide switch in the high position indicates an input value of 1 , the slide switch in the low position indicates an input value of 0. The figure above indicates an input of in0=0, in1=0, in2=0.

An illuminated LED indicates the output is 1 , where a LED that is not illuminated indicates an output of 0. The image above indicates an output of out0=0, out1=1, out2=0, out3=0, out4=0, out5=0, in6=0, in7=0.

Note: The image above does not adhere to our circuit specification. An input of in0=0, in1=0, in2= should result in an output configuration of out0=1, out1=0, out2=0, out3=0, out4=0, out5=0, in6=0, in7=0.

NET "in2" LOC = "H18";

NET "in1" LOC = "L14";

NET "in0" LOC = "L13";

NET "out7" LOC = "F9";

NET "out6" LOC = "E9";

NET "out5" LOC = "D11";

NET "out4" LOC = "C11";

NET "out3" LOC = "F11";

NET "out2" LOC = "E11";

NET "out1" LOC = "E12";

NET "out0" LOC = "F12";

in2 in1 in

out6 out

out

out

out

out

out7 out