Holey_yan

20141002_KUAS_Verilog_Design_5Bit

Oct 17th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*******************************************/
  2. /** 20141002 5-Bit Design (Use Data Flow) **/
  3. /** Maker  : Yan                          **/
  4. /** E-Mail : [email protected]        **/
  5. /** Date   : 2014/10/02 pm.10:55          **/
  6. /*******************************************/
  7.  
  8. module Design_5Bit(select, input1, input2, output1);
  9.     input       [3:0]       select, input1, input2;
  10.     output reg  [4:0]       output1;
  11.    
  12.     always@(input1)
  13.     begin
  14.         case(select)
  15.             4'b1101 : output1 = ~(input1 & input2);
  16.             4'b1100 : output1 = (input1 ~^ input2);
  17.             4'b0111 : output1 = input1 / 2;
  18.             4'b0101 : output1 = input1 * 2;
  19.             4'b0001 : output1 = (input1 > input2) ? input1 : input2;
  20.             4'b0000 : output1 = (input1 > input2) ? 5'b11111 : 5'b00000;
  21.             default : output1 = 5'b01001;
  22.         endcase
  23.     end
  24. endmodule
Advertisement
Add Comment
Please, Sign In to add comment