Advertisement
AlexanderAntonov

Untitled

Nov 7th, 2022
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Accumulator (
  2.     input  logic        clk,
  3.     input  logic        direction,
  4.     input  logic [15:0] increment,
  5.     output logic [15:0] result
  6. );
  7.     logic [15:0] next;
  8.  
  9.     always_comb begin
  10.         if (direction)
  11.             next = result + increment;
  12.         else
  13.             next = result - increment;
  14.     end
  15.  
  16.     always_ff @(posedge clk)
  17.         result <= next;
  18. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement