REPORTLAB3 Ee271
REPORTLAB3 Ee271
REPORTLAB3 Ee271
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
OUTLINE
I. LAB REQUIREMENTS AND THE SOLUTION II. SYSTEM DESIGN III. CODE AND SIMULATION IV. CONCLUSIONS
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
I.
In this laboratory, we are required to design a system that displays the code of the items in the 7 segments decoders as well as displays on sale? and expensive? states of yes or no of th ese items in both 7 segments decoders and Red LEDs. The input of this systems is controlled by 3 switches, whose on, off states demonstrates the binary UPC code of items. The on sale LEDR*1+ and expensive LEDR*0+ display as same as the on sale and expensive 7 segments decoders, respectively.
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
We have the table ruling the outputs display: x ( input ) LedOut1 (code letter) 1111111 0001000 1111111 0000000 0110001 0001000 0111000 0110001 LedOut2 LedOut3 (code number) (on sale? state) 1111111 1111111 1001111 1111111 1111111 1111111 0000110 1111111 0100100 0000000 0000100 1111111 0010010 0000000 0000000 0000000 LedOut4 (expensive? state 1111111 0000000 1111111 1111111 1111111 0000000 0000000 1111111 LEDR[0] LEDR[1]
0 1 0 0 0 1 1 0
0 0 0 0 1 0 1 1
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
II.
SYSTEM DESIGN
LedOut1 (7 bits) LedOut2 (7 bits) x (3 bit) STUDENT SHOP LedOut2 (7 bits) LedOut2 (7 bits) LEDR (2 bits)
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
III.
VERILOG CODE
module StudentShop(LedOut1, LedOut2, LedOut3, LedOut4, LEDR, x); output reg [0:6] LedOut1; output reg [0:6] LedOut2; output reg [0:6] LedOut3; output reg [0:6] LedOut4; output reg [0:1] LEDR; input [0:2] x; always @(x) case (x) 3'b001: begin LedOut1 LedOut2 LedOut3 LedOut4 LEDR[1] LEDR[0] end 3'b011: begin LedOut1 = 7'b0000000; LedOut2 = 7'b0000110; LedOut3 = 7'b1111111; LedOut4 = 7'b1111111; LEDR[1]= 0; LEDR[0] = 0; end 3'b100: begin LedOut1 LedOut2 LedOut3 LedOut4 LEDR[1] LEDR[0] end 3'b101: begin LedOut1 LedOut2 LedOut3 LedOut4 LEDR[1] LEDR[0] end 3'b110: begin LedOut1 = 7'b0111000; LedOut2 = 7'b0010010; = = = = = = 7'b0001000; 7'b0000100; 7'b1111111; 7'b0000000; 0; 1; = = = = = = 7'b0110001; 7'b0100100; 7'b0000000; 7'b1111111; 1; 0; = = = = = = 7'b0001000; 7'b1001111; 7'b1111111; 7'b0000000; 0; 1;
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr LedOut3 LedOut4 LEDR[1] LEDR[0] end 3'b111: begin LedOut1 LedOut2 LedOut3 LedOut4 LEDR[1] LEDR[0] end default: begin LedOut1 = LedOut2 = LedOut3 = LedOut4 = LEDR[1] = LEDR[0] = end endcase endmodule 7'b 7'b 7'b 7'b 0; 0; 1111111; 1111111; 1111111; 1111111; //1 //1 //1 //1 = = = = = = 7'b0110001; 7'b0000000; 7'b0000000; 7'b1111111; 1; 0; = = = = 7'b0000000; 7'b0000000; 1; 1;
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
10
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
WAVEFORM:
11
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
COMMENTS:
The simulation is as we expect. For example, when the input is 011, the LedOut1 is 0000000 ( that is letter B ), the LedOut2 is 0000110 ( that is number 3 ), the LedOut3 is 1111111 ( nothing, means no ), the LedOut3 is 1111111(nothing, means no ), LEDR[0] and LEDR[1] are both 0.
The real result when we run the system in the FPGA KIT is the same as simulation.
12
Extra Lab - Student Shop Group 10 : Nguyn nh Minh Nht-Trng Minh Quc-Ng Nh Tr
IV.
CONCLUSIONS