TheLegace

Lab2

Sep 26th, 2011
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Lab2(
  2.                 output reg [5:0] LED,
  3.                 input [6:0] SW
  4. ); 
  5.     reg [2:0] display;
  6.    
  7.     always @ (SW)
  8.     begin
  9.     if(SW[2:0] < SW[5:3])
  10.         display = SW[5:3];
  11.     else display = SW[2:0];
  12.    
  13.     case(display)
  14.         3'b000: LED = 7'b1000000;
  15.         3'b001: LED = 7'b1111001;
  16.         3'b010: LED = 7'b0100100;
  17.         3'b011: LED = 7'b0110000;
  18.         3'b100: LED = 7'b0011001;
  19.         3'b101: LED = 7'b0010010;
  20.         3'b110: LED = 7'b0000010;
  21.         3'b111: LED = 7'b1111000;
  22.     endcase
  23.     end
  24. endmodule
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment