Advertisement
Guest User

modopm

a guest
Aug 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module modpm(
  2. input logic [5:0]in_num,
  3. input logic mode12,
  4. output logic [5:0] out_num,
  5. output logic [1:0] diatarde
  6.     );
  7.    
  8.    
  9.  localparam hrs24 =   2'b00;
  10.    localparam AM =   2'b01;
  11.     localparam PM = 2'b10;
  12.     localparam doce =   6'd12;
  13.    
  14.    
  15. always_comb
  16.     if(mode12 == 1)
  17.      
  18.         if (in_num >= doce) begin
  19.             out_num= in_num - doce;
  20.             diatarde = PM;
  21.             end
  22.            
  23.         else
  24.             begin
  25.             out_num = in_num ;
  26.             diatarde = AM;
  27.             end
  28.            
  29.    
  30.     else
  31.             begin
  32.             out_num = in_num ;
  33.             diatarde = hrs24;
  34.             end
  35.    
  36. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement