diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-08-30 09:50:20 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-30 09:50:20 -0700 |
commit | 295c18bd6b8d3fa503041904f7f7df392a4b5167 (patch) | |
tree | 9a20c23d61a5c714ca8408c40d2e71345deff088 /techlibs/anlogic/arith_map.v | |
parent | 4cc74346f11e96b9a2bce1c984c674a22771a00a (diff) | |
parent | 6919c0f9b010c94a0a1a31cd788301e78a1bcbfb (diff) | |
download | yosys-295c18bd6b8d3fa503041904f7f7df392a4b5167.tar.gz yosys-295c18bd6b8d3fa503041904f7f7df392a4b5167.tar.bz2 yosys-295c18bd6b8d3fa503041904f7f7df392a4b5167.zip |
Merge branch 'xc7dsp' of github.com:YosysHQ/yosys into xc7dsp
Diffstat (limited to 'techlibs/anlogic/arith_map.v')
-rw-r--r-- | techlibs/anlogic/arith_map.v | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/techlibs/anlogic/arith_map.v b/techlibs/anlogic/arith_map.v index 6d6a7ca37..1186543da 100644 --- a/techlibs/anlogic/arith_map.v +++ b/techlibs/anlogic/arith_map.v @@ -31,7 +31,10 @@ module _80_anlogic_alu (A, B, CI, BI, X, Y, CO); output [Y_WIDTH-1:0] X, Y; input CI, BI; - output CO; + output [Y_WIDTH-1:0] CO; + + wire CIx; + wire [Y_WIDTH-1:0] COx; wire _TECHMAP_FAIL_ = Y_WIDTH <= 2; @@ -41,15 +44,16 @@ module _80_anlogic_alu (A, B, CI, BI, X, Y, CO); wire [Y_WIDTH-1:0] AA = A_buf; wire [Y_WIDTH-1:0] BB = BI ? ~B_buf : B_buf; - wire [Y_WIDTH+1:0] COx; - wire [Y_WIDTH+2:0] C = {COx, CI}; + wire [Y_WIDTH-1:0] C = { COx, CIx }; wire dummy; AL_MAP_ADDER #( .ALUTYPE("ADD_CARRY")) adder_cin ( - .a(C[0]), - .o({COx[0], dummy}) + .a(CI), + .b(1'b0), + .c(1'b0), + .o({CIx, dummy}) ); genvar i; @@ -59,18 +63,22 @@ module _80_anlogic_alu (A, B, CI, BI, X, Y, CO); ) adder_i ( .a(AA[i]), .b(BB[i]), - .c(C[i+1]), - .o({COx[i+1],Y[i]}) + .c(C[i]), + .o({COx[i],Y[i]}) ); - end: slice + + wire cout; + AL_MAP_ADDER #( + .ALUTYPE("ADD")) + adder_cout ( + .a(1'b0), + .b(1'b0), + .c(COx[i]), + .o({cout, CO[i]}) + ); + end: slice endgenerate - /* End implementation */ - AL_MAP_ADDER #( - .ALUTYPE("ADD")) - adder_cout ( - .c(C[Y_WIDTH+1]), - .o(COx[Y_WIDTH+1]) - ); - assign CO = COx[Y_WIDTH+1]; - assign X = AA ^ BB; -endmodule
\ No newline at end of file + + /* End implementation */ + assign X = AA ^ BB; +endmodule |