You are on page 1of 10

EE311

(VLSI Laboratory)

EXPERIMENT 4
DISPLAY ROLL NUMBER IN 6 BIT SEVEN SEGMENT
DISPLAY

Aim: -
In this experiment we have to interface 6 bit seven segment display with FPGA board and to display the
following:-

1) Roll number in static condition

2) Roll number in scrolling condition

Materials Required: -
1) Spartan 3E Starter Board(FPGA Board)

2) 6 bit seven segment display

3) Xilinx ISE Design Suite(Software)

4) Xilinx Plan Ahead(Software)

5) ISim(Software)

6) iMPACT(Software)

Theory: -
Seven Segment Display: -
A seven-segment display is commonly used in electronic display device for decimal numbers from 0 to 9
and in some cases, basic characters. Use of light emitting diodes (LEDs) in seven segment displays made
it more popular, whereas of late liquid crystal displays (LCD) displays have also come into use.

Displaying of Roll Number: -


We cannot send all the roll number data in one go in the six bit seven segment display. We have to send
the data serially. For this purpose first design a clock divider, so that the change in the bits serially
cannot be visualised with naked eye. After this select one Select line as send the data one by one.

Displaying of Roll Number in Scrolling Mode: -


For this design two clocks( One faster and another slower. We have to make cases for each instant in a
scrolling procedure. Fast clock in used to display the characters present in that instant while the slower
clock is used to change the instants one by one. In every instant case, the data is shifted and the led
behind gets off. When the data has scrolled successfully for one time, then in another instant the data
will start coming from left and have to reach the right end.

Verilog Code for Static Display


module Seven_Seg(
input clk,
input rst,
output reg[5:0]a,
output reg[6:0] LED_out
);

clock_divnew cc(clk,rst,clk1);

reg[2:0]c;
reg[3:0]in;
initial
c=0;
always@(posedge clk1)
begin

c=c+1;
case(c)
3'b001:   begin
a=6'b011111;
in=4'b0001;
end
3'b010: begin
a=6'b101111;
in=4'b0111;
end
3'b011: begin
a=6'b110111;
in=4'b0000;
end
3'b100: begin
a=6'b111011;
in=4'b0001;
end
3'b101: begin
a=6'b111101;
in=4'b0010;
end
3'b110: begin
a=6'b111110;
in=4'b1001;
end
default: a=6'b111111;
endcase
 case(in)
 4'b0000: LED_out = 7'b0000001;
 4'b0001: LED_out = 7'b1001111;
 4'b0010: LED_out = 7'b0010010;
 4'b0011: LED_out = 7'b0000110;
 4'b0100: LED_out = 7'b1001100;
 4'b0101: LED_out = 7'b0100100;
 4'b0110: LED_out = 7'b0100000;
 4'b0111: LED_out = 7'b0001111;
 4'b1000: LED_out = 7'b0000000;
 4'b1001: LED_out = 7'b0000100;
 4'b1010: LED_out = 7'b0001000;
 4'b1011: LED_out = 7'b1100000;
 4'b1100: LED_out = 7'b0110001;
 4'b1101: LED_out = 7'b1000010;
 4'b1110: LED_out = 7'b0110000;
 4'b1111: LED_out = 7'b0111000;
 
 default: LED_out = 7'b1111110;
 endcase
end
endmodule

Verilog code for Scrolling Display


module Seg_Slide(input clk,
input rst,
output reg[5:0]a,
output reg[6:0] LED_out
);

clock_divider cc(clk,rst,clk1);

reg[2:0]c;
reg[3:0]in;
reg[2:0]roll;
reg[10:0]clk2;
initial
begin
c=0;
clk2=11'b00000000000;
roll=0;
end
always@(posedge clk1)
begin

c=c+1;
clk2=clk2+1;
if(clk2 == 11'b10000000000)
begin
roll = roll + 1;
end

case(roll)
3'b000: begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b0001;
end
3'b010: begin
        a=6'b111101;
 in=4'b0111;
 end
3'b011: begin
        a=6'b111011;
 in=4'b0000;
 end
3'b100: begin
        a=6'b110111;
 in=4'b0001;
 end
3'b101: begin
        a=6'b101111;
 in=4'b1110;
 end
3'b110: begin
        a=6'b011111;
 in=4'b1110;
        end

default: a=6'b111111;
endcase

//a=6'b0111100;
 case(in)
 4'b0000: LED_out = 7'b0000001; // "0"  
 4'b0001: LED_out = 7'b1001111; // "1"
 4'b0010: LED_out = 7'b0010010; // "2"
 4'b0011: LED_out = 7'b0000110; // "3"
 4'b0100: LED_out = 7'b1001100; // "4"
 4'b0101: LED_out = 7'b0100100; // "5"
 4'b0110: LED_out = 7'b0100000; // "6"
 4'b0111: LED_out = 7'b0001111; // "7"
 4'b1000: LED_out = 7'b0000000; // "8"  
 4'b1001: LED_out = 7'b0000100; // "9"
 4'b1010: LED_out = 7'b0001000; // "10"
 4'b1011: LED_out = 7'b1100000; // "11"
 4'b1100: LED_out = 7'b0110001; // "12"
 4'b1101: LED_out = 7'b1000010; // "13"
 4'b1110: LED_out = 7'b0110000; // "14"
 4'b1111: LED_out = 7'b0111000; // "15"
 
//defining this as X
 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 

3'b001:begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b0111;
end
3'b010: begin
        a=6'b111101;
 in=4'b0000;
 end
3'b011: begin
        a=6'b111011;
 in=4'b0001;
 end
3'b100: begin
        a=6'b110111;
 in=4'b1110;
 end
3'b101: begin
        a=6'b101111;
 in=4'b1110;
 end
3'b110: begin
        a=6'b011111;
 in=4'b0001;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)

 default: LED_out = 7'b1111110; // "0"
 endcase
end

3'b010:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b0000;
end
3'b010: begin
        a=6'b111101;
 in=4'b0001;
 end
3'b011: begin
        a=6'b111011;
 in=4'b1110;
 end
3'b100: begin
        a=6'b110111;
 in=4'b1110;
 end
3'b101: begin
        a=6'b101111;
 in=4'b0001;
 end
3'b110: begin
        a=6'b011111;
 in=4'b1001;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)
 X
 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 

3'b011:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b0001;
end
3'b010: begin
        a=6'b111101;
 in=4'b1110;
 end
3'b011: begin
        a=6'b111011;
 in=4'b1110;
 end
3'b100: begin
        a=6'b110111;
 in=4'b0001;
 end
3'b101: begin
        a=6'b101111;
 in=4'b1001;
 end
3'b110: begin
        a=6'b011111;
 in=4'b0001;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)

 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 
 
3'b100:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b1110;
end
3'b010: begin
        a=6'b111101;
 in=4'b1110;
 end
3'b011: begin
        a=6'b111011;
 in=4'b0001;
 end
3'b100: begin
        a=6'b110111;
 in=4'b1001;
 end
3'b101: begin
        a=6'b101111;
 in=4'b0001;
 end
3'b110: begin
        a=6'b011111;
 in=4'b0111;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)

 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 
 
 
3'b101:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b1110;
end
3'b010: begin
        a=6'b111101;
 in=4'b0001;
 end
3'b011: begin
        a=6'b111011;
 in=4'b1001;
 end
3'b100: begin
        a=6'b110111;
 in=4'b0001;
 end
3'b101: begin
        a=6'b101111;
 in=4'b0111;
 end
3'b110: begin
        a=6'b011111;
 in=4'b0000;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)
X
 
 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 
 
 
3'b110:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b0001;
end
3'b010: begin
        a=6'b111101;
 in=4'b1001;
 end
3'b011: begin
        a=6'b111011;
 in=4'b0001;
 end
3'b100: begin
        a=6'b110111;
 in=4'b0111;
 end
3'b101: begin
        a=6'b101111;
 in=4'b0000;
 end
3'b110: begin
        a=6'b011111;
 in=4'b0001;
        end
default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)

 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 
 
 
 3'b111:
begin
case(c)
3'b001: begin
         a=6'b111110;
in=4'b1001;
end
3'b010: begin
        a=6'b111101;
 in=4'b0001;
 end
3'b011: begin
        a=6'b111011;
 in=4'b0111;
 end
3'b100: begin
        a=6'b110111;
 in=4'b0000;
 end
3'b101: begin
        a=6'b101111;
 in=4'b0001;
 end
3'b110: begin
        a=6'b011111;
 in=4'b1110;
        end

default: a=6'b111111;
endcase
//a=6'b0111100;
 case(in)
X
 default: LED_out = 7'b1111110; // "0"
 endcase
 end
 endcase
 

end
endmodule

UCF File
NET "clk" LOC = C9;
NET "rst" LOC = L13;
NET "LED_out[0]" LOC = F8;
NET "LED_out[1]" LOC = D7;
NET "LED_out[2]" LOC = F9;
NET "LED_out[3]" LOC = D11;
NET "LED_out[4]" LOC = E12;
NET "LED_out[5]" LOC = A13;
NET "LED_out[6]" LOC = A14;
NET "a[0]" LOC = A16;
NET "a[1]" LOC = E13;
NET "a[2]" LOC = B11;
NET "a[3]" LOC = A8;
NET "a[4]" LOC = A11;
NET "a[5]" LOC = G9

Conclusion: -
In this experiment we have used seven segment displays to display the roll number. We have learned
to use the select line controlled by a clock divider. Earlier we have made the clock divider. This code can
be used to display any string on the 6 bit seven segment display in both static and scrolling modes.My
Roll No i.e 1701EE19 is printed in rolling.

You might also like