Guest User

Untitled

a guest
May 30th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Medidor_Function (clock, reset_n, enable, control, data_out);
  2.  
  3. input clock, reset_n, control, enable;
  4. output reg [31:0] data_out;
  5. reg flag;
  6. reg [1:0] ctl;
  7. always @(negedge clock)
  8. begin
  9.     if(!reset_n)
  10.     begin
  11.         data_out <= 0;
  12.         flag <= 0;
  13.     end
  14.     else if (enable)
  15.     begin
  16.         flag <= 1;
  17.         ctl <= control;
  18.     end
  19.     if (flag)
  20.     begin
  21.         if (ctl == 0)
  22.             //data_out <= data_out + 1;
  23.             data_out <= 50;
  24.         if (ctl == 1)
  25.         begin
  26.             flag <= 0;
  27.             data_out <= 51;
  28.         end
  29.         if (ctl == 2)
  30.         begin
  31.             data_out <= 52; //0;
  32.             flag <= 0;
  33.         end
  34.     end
  35.        
  36. end
  37. endmodule
Advertisement
Add Comment
Please, Sign In to add comment