Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module dsw_4_12 (iDSW4, oDSW12);
  2.  
  3. input [3:0] iDSW4;
  4. output [11:0] oDSW12;
  5. reg [11:0] temp;
  6.  
  7. assign oDSW12 = temp;
  8.  
  9. always @ * begin
  10.     case (iDSW4)
  11.       4'b0000: temp = 12'b0000_0000_0000; //0
  12.       4'b0001: temp = 12'b0000_1111_1111; //1
  13.       4'b0010: temp = 12'b0001_1111_1110; //2
  14.       4'b0011: temp = 12'b0010_1111_1101; //3
  15.       4'b0100: temp = 12'b0011_1111_1100; //4
  16.       4'b0101: temp = 12'b0100_1111_1011; //5
  17.       4'b0110: temp = 12'b0101_1111_1010; //6
  18.       4'b0111: temp = 12'b0110_1111_1001; //7
  19.       4'b1000: temp = 12'b0111_1111_1000; //8
  20.       4'b1001: temp = 12'b1000_1111_0111; //9
  21.       4'b1010: temp = 12'b1001_1111_0110; //10
  22.       4'b1011: temp = 12'b1010_1111_0101; //11
  23.       4'b1100: temp = 12'b1011_1111_0100; //12
  24.       4'b1101: temp = 12'b1100_1111_0011; //13
  25.       4'b1110: temp = 12'b1101_1111_0010; //14
  26.       4'b1111: temp = 12'b1110_1111_0001; //15
  27.     endcase
  28. end
  29.  
  30. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement