Advertisement
Guest User

kkkkkkkk

a guest
Apr 26th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module seven_seg_decoder(in,A,B,C,D,E,F,G,enable);
  2.     input [3:0] in;
  3.     input enable;
  4.     output A,B,C,D,E,F,G;
  5.     reg [6:0] DISPLAY;
  6.     always @(in[3] or in[2] or in[1] or in[0])
  7.     begin
  8.         if(enable == 1'b1)
  9.         begin
  10.             case ({in[3],in[2],in[1],in[0]})
  11.                 4'b0000: DISPLAY = 7'b0000001;
  12.                 4'b0001: DISPLAY = 7'b1001111;
  13.                 4'b0010: DISPLAY = 7'b0010010;
  14.                 4'b0011: DISPLAY = 7'b0000110;
  15.                 4'b0100: DISPLAY = 7'b1001100;
  16.                 4'b0101: DISPLAY = 7'b0100100;
  17.                 4'b0110: DISPLAY = 7'b0100000;
  18.                 4'b0111: DISPLAY = 7'b0001111;
  19.                 4'b1000: DISPLAY = 7'b0000000;
  20.                 4'b1001: DISPLAY = 7'b0000100;
  21.                 4'b1010: DISPLAY = 7'b0001000;
  22.                 4'b1011: DISPLAY = 7'b1100000;
  23.                 4'b1100: DISPLAY = 7'b0110001;
  24.                 4'b1101: DISPLAY = 7'b1000010;
  25.                 4'b1110: DISPLAY = 7'b0110000;
  26.                 4'b1111: DISPLAY = 7'b0111000;
  27.             endcase
  28.         end
  29.         else
  30.         begin
  31.             DISPLAY = 7'b1111111;
  32.         end
  33.     end
  34.     assign {A,B,C,D,E,F,G} = DISPLAY;
  35.  
  36. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement