AlexanderAntonov

Untitled

Nov 5th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module module_name (<ports declaration>);
  2.  
  3. // scheduling control unit (may also be an FSM)
  4. localparam CSTEP_NUM = 10;      // number of c-steps in schedule
  5. logic [3:0] cstep_counter;
  6. always @(posedge clk_i)
  7.     begin
  8.     if (rst_i) cstep_counter <= 4’d0;
  9.     else if (cstep_counter == CSTEP_NUM-1) cstep_counter <= 4’d0;
  10.     else cstep_counter <= cstep_counter + 4’d1;
  11.     end
  12. logic computation_finished_o;   // identifies completion of execution
  13. assign computation_finished_o = (cstep_counter == CSTEP_NUM-1) ? 1’b1 : 1’b0;
  14.  
  15. // datapath
  16. <datapath signals declaration>
  17. always @*
  18.     begin
  19.     <default value assignments>
  20.     case (cstep_counter)
  21.         4’d0: begin some_dst = some_src0 + some_src1; end // stage 0 of execution
  22.         4’d1: beginend                       // stage 1 of execution
  23.         …
  24.     endcase
  25.      
  26. endmodule
Add Comment
Please, Sign In to add comment