Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module dec3to8(W, En, Y);
  2.   input [2:0] W;
  3.   input En;
  4.   output [0:7] Y;
  5.   reg [0:7] Y;
  6.  
  7.   always @(W or En)
  8.   begin
  9.     if (En == 1)
  10.       case (W)
  11.         3'b000: Y = 8'b00000001;
  12.         3'b001: Y = 8'b00000010;
  13.         3'b010: Y = 8'b00000100;
  14.         3'b011: Y = 8'b00001000;
  15.         3'b100: Y = 8'b00010000;
  16.         3'b101: Y = 8'b00100000;
  17.         3'b110: Y = 8'b01000000;
  18.         3'b111: Y = 8'b10000000;
  19.       endcase
  20.     else
  21.       Y = 8'b00000000;
  22.   end
  23. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement