Guest User

Untitled

a guest
May 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2. /**
  3.     @brief A 32-bit adder pipelined to operate at 500 MHz
  4.  */
  5. module HighSpeedAdder(clk, a, b, s);
  6.  
  7.     input wire clk;
  8.     input wire[31:0] a;
  9.     input wire[31:0] b;
  10.     output reg[31:0] s=0;
  11.    
  12.     reg[16:0] lowsum=0;
  13.     reg[15:0] ahi;
  14.     reg[15:0] bhi;
  15.    
  16.     always @(posedge clk) begin
  17.    
  18.         //Sum low-order bits and save high-order for next clock
  19.         lowsum <= a[15:0] + b[15:0];
  20.         ahi <= a[31:16];
  21.         bhi <= b[31:16];
  22.        
  23.         //Sum high-order bits + carry out from previous pipe stage
  24.         s[15:0] <= lowsum[15:0];
  25.         s[31:16] <= ahi + bhi + lowsum[16];
  26.        
  27.     end
  28.  
  29. endmodule
Add Comment
Please, Sign In to add comment