Advertisement
ZirconiumX

Untitled

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