Advertisement
ZirconiumX

Untitled

Jun 16th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. (* techmap_celltype = "$add" *)
  2. module _80_74283_add (A, B, Y);
  3.  
  4. parameter A_SIGNED = 0;
  5. parameter B_SIGNED = 0;
  6. parameter A_WIDTH = 0;
  7. parameter B_WIDTH = 0;
  8. parameter Y_WIDTH = 0;
  9.  
  10. input [A_WIDTH-1:0] A;
  11. input [B_WIDTH-1:0] B;
  12. output [Y_WIDTH-1:0] Y;
  13.  
  14. localparam WIDTH = ((Y_WIDTH + 3) / 4) * 4;
  15.  
  16. wire [WIDTH/4:0] CARRY;
  17.  
  18. wire [Y_WIDTH-1:0] A_buf, B_buf;
  19. \$pos #(.A_SIGNED(A_SIGNED), .A_WIDTH(A_WIDTH), .Y_WIDTH(Y_WIDTH)) A_conv (.A(A), .Y(A_buf));
  20. \$pos #(.A_SIGNED(B_SIGNED), .A_WIDTH(B_WIDTH), .Y_WIDTH(Y_WIDTH)) B_conv (.A(B), .Y(B_buf));
  21.  
  22. wire [Y_WIDTH-1:0] AA = A_buf;
  23. wire [Y_WIDTH-1:0] BB = B_buf;
  24. wire [Y_WIDTH:0] C;
  25.  
  26. genvar i;
  27. generate for (i = 0; i < WIDTH; i = i + 4) begin:slice
  28. \74283 adder_i (
  29. .A(AA[i+3:i]),
  30. .B(BB[i+3:i]),
  31. .CI(C[i]),
  32. .S(Y[i+3:i]),
  33. .CO(C[i+4]),
  34. );
  35. end
  36. endgenerate
  37.  
  38. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement