yowasp-yosys 0.52.0.0.post894__py3-none-any.whl → 0.54.0.0.post930__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yowasp_yosys/share/ecp5/cells_sim.v +1 -1
- yowasp_yosys/share/gatemate/brams.txt +0 -1
- yowasp_yosys/share/gatemate/brams_map.v +20 -20
- yowasp_yosys/share/gatemate/cells_sim.v +3 -3
- yowasp_yosys/share/greenpak4/cells_sim_digital.v +31 -31
- yowasp_yosys/share/include/backends/cxxrtl/runtime/cxxrtl/capi/cxxrtl_capi.h +4 -0
- yowasp_yosys/share/include/backends/cxxrtl/runtime/cxxrtl/cxxrtl.h +8 -2
- yowasp_yosys/share/include/kernel/consteval.h +1 -1
- yowasp_yosys/share/include/kernel/constids.inc +2 -0
- yowasp_yosys/share/include/kernel/hashlib.h +1 -0
- yowasp_yosys/share/include/kernel/io.h +17 -0
- yowasp_yosys/share/include/kernel/macc.h +28 -28
- yowasp_yosys/share/include/kernel/register.h +1 -0
- yowasp_yosys/share/include/kernel/rtlil.h +225 -32
- yowasp_yosys/share/include/kernel/yosys.h +1 -0
- yowasp_yosys/share/include/kernel/yosys_common.h +1 -17
- yowasp_yosys/share/python3/sby_status.py +2 -2
- yowasp_yosys/share/xilinx/urams.txt +22 -0
- yowasp_yosys/share/xilinx/urams_map.v +138 -0
- yowasp_yosys/yosys.wasm +0 -0
- {yowasp_yosys-0.52.0.0.post894.dist-info → yowasp_yosys-0.54.0.0.post930.dist-info}/METADATA +1 -1
- {yowasp_yosys-0.52.0.0.post894.dist-info → yowasp_yosys-0.54.0.0.post930.dist-info}/RECORD +25 -25
- {yowasp_yosys-0.52.0.0.post894.dist-info → yowasp_yosys-0.54.0.0.post930.dist-info}/WHEEL +1 -1
- {yowasp_yosys-0.52.0.0.post894.dist-info → yowasp_yosys-0.54.0.0.post930.dist-info}/entry_points.txt +0 -0
- {yowasp_yosys-0.52.0.0.post894.dist-info → yowasp_yosys-0.54.0.0.post930.dist-info}/top_level.txt +0 -0
|
@@ -115,15 +115,15 @@ generate
|
|
|
115
115
|
.A_CLK(PORT_A_CLK),
|
|
116
116
|
.A_EN(PORT_A_CLK_EN),
|
|
117
117
|
.A_WE(PORT_A_WR_EN),
|
|
118
|
-
.A_BM(PORT_A_WR_BE),
|
|
119
|
-
.A_DI(PORT_A_WR_DATA),
|
|
118
|
+
.A_BM({{(20-PORT_A_WR_BE_WIDTH){1'bx}}, PORT_A_WR_BE}),
|
|
119
|
+
.A_DI({{(20-PORT_A_WR_WIDTH){1'bx}}, PORT_A_WR_DATA}),
|
|
120
120
|
.A_ADDR({PORT_A_ADDR[13:5], 1'b0, PORT_A_ADDR[4:0], 1'b0}),
|
|
121
121
|
.A_DO(PORT_A_RD_DATA),
|
|
122
122
|
.B_CLK(PORT_B_CLK),
|
|
123
123
|
.B_EN(PORT_B_CLK_EN),
|
|
124
124
|
.B_WE(PORT_B_WR_EN),
|
|
125
|
-
.B_BM(PORT_B_WR_BE),
|
|
126
|
-
.B_DI(PORT_B_WR_DATA),
|
|
125
|
+
.B_BM({{(20-PORT_B_WR_BE_WIDTH){1'bx}}, PORT_B_WR_BE}),
|
|
126
|
+
.B_DI({{(20-PORT_B_WR_WIDTH){1'bx}}, PORT_B_WR_DATA}),
|
|
127
127
|
.B_ADDR({PORT_B_ADDR[13:5], 1'b0, PORT_B_ADDR[4:0], 1'b0}),
|
|
128
128
|
.B_DO(PORT_B_RD_DATA),
|
|
129
129
|
);
|
|
@@ -270,15 +270,15 @@ generate
|
|
|
270
270
|
.A_CLK(PORT_A_CLK),
|
|
271
271
|
.A_EN(PORT_A_CLK_EN),
|
|
272
272
|
.A_WE(PORT_A_WR_EN),
|
|
273
|
-
.A_BM(PORT_A_WR_BE),
|
|
274
|
-
.A_DI(PORT_A_WR_DATA),
|
|
273
|
+
.A_BM({{(40-PORT_A_WR_BE_WIDTH){1'bx}}, PORT_A_WR_BE}),
|
|
274
|
+
.A_DI({{(40-PORT_A_WR_WIDTH){1'bx}}, PORT_A_WR_DATA}),
|
|
275
275
|
.A_ADDR({PORT_A_ADDR[14:0], 1'b0}),
|
|
276
276
|
.A_DO(PORT_A_RD_DATA),
|
|
277
277
|
.B_CLK(PORT_B_CLK),
|
|
278
278
|
.B_EN(PORT_B_CLK_EN),
|
|
279
279
|
.B_WE(PORT_B_WR_EN),
|
|
280
|
-
.B_BM(PORT_B_WR_BE),
|
|
281
|
-
.B_DI(PORT_B_WR_DATA),
|
|
280
|
+
.B_BM({{(40-PORT_B_WR_BE_WIDTH){1'bx}}, PORT_B_WR_BE}),
|
|
281
|
+
.B_DI({{(40-PORT_B_WR_WIDTH){1'bx}}, PORT_B_WR_DATA}),
|
|
282
282
|
.B_ADDR({PORT_B_ADDR[14:0], 1'b0}),
|
|
283
283
|
.B_DO(PORT_B_RD_DATA),
|
|
284
284
|
);
|
|
@@ -429,14 +429,14 @@ generate
|
|
|
429
429
|
.A_CLK(PORT_A_CLK),
|
|
430
430
|
.A_EN(PORT_A_CLK_EN),
|
|
431
431
|
.A_WE(PORT_A_WR_EN),
|
|
432
|
-
.A_BM(PORT_A_WR_BE),
|
|
433
|
-
.A_DI(PORT_A_WR_DATA),
|
|
432
|
+
.A_BM({{(40-PORT_A_WR_BE_WIDTH){1'bx}}, PORT_A_WR_BE}),
|
|
433
|
+
.A_DI({{(40-PORT_A_WR_WIDTH){1'bx}}, PORT_A_WR_DATA}),
|
|
434
434
|
.A_ADDR({PORT_A_ADDR[14:0], PORT_A_ADDR[15]}),
|
|
435
435
|
.B_CLK(PORT_B_CLK),
|
|
436
436
|
.B_EN(PORT_B_CLK_EN),
|
|
437
437
|
.B_WE(PORT_B_WR_EN),
|
|
438
|
-
.B_BM(PORT_B_WR_BE),
|
|
439
|
-
.B_DI(PORT_B_WR_DATA),
|
|
438
|
+
.B_BM({{(40-PORT_B_WR_BE_WIDTH){1'bx}}, PORT_B_WR_BE}),
|
|
439
|
+
.B_DI({{(40-PORT_B_WR_WIDTH){1'bx}}, PORT_B_WR_DATA}),
|
|
440
440
|
.B_ADDR({PORT_B_ADDR[14:0], PORT_B_ADDR[15]}),
|
|
441
441
|
);
|
|
442
442
|
CC_BRAM_40K #(
|
|
@@ -584,15 +584,15 @@ generate
|
|
|
584
584
|
.A_CLK(PORT_A_CLK),
|
|
585
585
|
.A_EN(PORT_A_CLK_EN),
|
|
586
586
|
.A_WE(PORT_A_WR_EN),
|
|
587
|
-
.A_BM(PORT_A_WR_BE),
|
|
588
|
-
.A_DI(PORT_A_WR_DATA),
|
|
587
|
+
.A_BM({{(40-PORT_A_WR_BE_WIDTH){1'bx}}, PORT_A_WR_BE}),
|
|
588
|
+
.A_DI({{(40-PORT_A_WR_WIDTH){1'bx}}, PORT_A_WR_DATA}),
|
|
589
589
|
.A_DO(PORT_A_RD_DATA),
|
|
590
590
|
.A_ADDR({PORT_A_ADDR[14:0], PORT_A_ADDR[15]}),
|
|
591
591
|
.B_CLK(PORT_B_CLK),
|
|
592
592
|
.B_EN(PORT_B_CLK_EN),
|
|
593
593
|
.B_WE(PORT_B_WR_EN),
|
|
594
|
-
.B_BM(PORT_B_WR_BE),
|
|
595
|
-
.B_DI(PORT_B_WR_DATA),
|
|
594
|
+
.B_BM({{(40-PORT_B_WR_BE_WIDTH){1'bx}}, PORT_B_WR_BE}),
|
|
595
|
+
.B_DI({{(40-PORT_B_WR_WIDTH){1'bx}}, PORT_B_WR_DATA}),
|
|
596
596
|
.B_DO(PORT_B_RD_DATA),
|
|
597
597
|
.B_ADDR({PORT_B_ADDR[14:0], PORT_B_ADDR[15]}),
|
|
598
598
|
);
|
|
@@ -710,9 +710,9 @@ generate
|
|
|
710
710
|
.A_EN(PORT_W_CLK_EN),
|
|
711
711
|
.A_WE(PORT_W_WR_EN),
|
|
712
712
|
.A_BM(PORT_W_WR_BE[19:0]),
|
|
713
|
-
.B_BM(PORT_W_WR_BE[39:20]),
|
|
713
|
+
.B_BM({{(40-PORT_W_WIDTH){1'bx}}, PORT_W_WR_BE[39:20]}),
|
|
714
714
|
.A_DI(PORT_W_WR_DATA[19:0]),
|
|
715
|
-
.B_DI(PORT_W_WR_DATA[39:20]),
|
|
715
|
+
.B_DI({{(40-PORT_W_WIDTH){1'bx}}, PORT_W_WR_DATA[39:20]}),
|
|
716
716
|
.A_ADDR({PORT_W_ADDR[13:5], 1'b0, PORT_W_ADDR[4:0], 1'b0}),
|
|
717
717
|
.B_CLK(PORT_R_CLK),
|
|
718
718
|
.B_EN(PORT_R_CLK_EN),
|
|
@@ -865,9 +865,9 @@ generate
|
|
|
865
865
|
.A_EN(PORT_W_CLK_EN),
|
|
866
866
|
.A_WE(PORT_W_WR_EN),
|
|
867
867
|
.A_BM(PORT_W_WR_BE[39:0]),
|
|
868
|
-
.B_BM(PORT_W_WR_BE[79:40]),
|
|
868
|
+
.B_BM({{(80-PORT_W_WIDTH){1'bx}}, PORT_W_WR_BE[79:40]}),
|
|
869
869
|
.A_DI(PORT_W_WR_DATA[39:0]),
|
|
870
|
-
.B_DI(PORT_W_WR_DATA[79:40]),
|
|
870
|
+
.B_DI({{(80-PORT_W_WIDTH){1'bx}}, PORT_W_WR_DATA[79:40]}),
|
|
871
871
|
.A_ADDR({PORT_W_ADDR[14:0], 1'b0}),
|
|
872
872
|
.B_CLK(PORT_R_CLK),
|
|
873
873
|
.B_EN(PORT_R_CLK_EN),
|
|
@@ -292,10 +292,10 @@ module CC_DLT #(
|
|
|
292
292
|
always @(*)
|
|
293
293
|
begin
|
|
294
294
|
if (sr) begin
|
|
295
|
-
Q
|
|
295
|
+
Q = SR_VAL;
|
|
296
296
|
end
|
|
297
297
|
else if (en) begin
|
|
298
|
-
Q
|
|
298
|
+
Q = D;
|
|
299
299
|
end
|
|
300
300
|
end
|
|
301
301
|
|
|
@@ -407,7 +407,7 @@ module CC_MULT #(
|
|
|
407
407
|
);
|
|
408
408
|
always @(*)
|
|
409
409
|
begin
|
|
410
|
-
P
|
|
410
|
+
P = A * B;
|
|
411
411
|
end
|
|
412
412
|
endmodule
|
|
413
413
|
|
|
@@ -48,7 +48,7 @@ module GP_COUNT14(input CLK, input wire RST, output reg OUT);
|
|
|
48
48
|
|
|
49
49
|
//Combinatorially output underflow flag whenever we wrap low
|
|
50
50
|
always @(*) begin
|
|
51
|
-
OUT
|
|
51
|
+
OUT = (count == 14'h0);
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
//POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
|
|
@@ -133,10 +133,10 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
|
|
|
133
133
|
//Combinatorially output underflow flag whenever we wrap low
|
|
134
134
|
always @(*) begin
|
|
135
135
|
if(UP)
|
|
136
|
-
OUT
|
|
136
|
+
OUT = (count == 14'h3fff);
|
|
137
137
|
else
|
|
138
|
-
OUT
|
|
139
|
-
POUT
|
|
138
|
+
OUT = (count == 14'h0);
|
|
139
|
+
POUT = count[7:0];
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
//POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
|
|
@@ -272,10 +272,10 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
|
|
|
272
272
|
//Combinatorially output underflow flag whenever we wrap low
|
|
273
273
|
always @(*) begin
|
|
274
274
|
if(UP)
|
|
275
|
-
OUT
|
|
275
|
+
OUT = (count == 8'hff);
|
|
276
276
|
else
|
|
277
|
-
OUT
|
|
278
|
-
POUT
|
|
277
|
+
OUT = (count == 8'h0);
|
|
278
|
+
POUT = count;
|
|
279
279
|
end
|
|
280
280
|
|
|
281
281
|
//POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
|
|
@@ -413,8 +413,8 @@ module GP_COUNT8(
|
|
|
413
413
|
|
|
414
414
|
//Combinatorially output underflow flag whenever we wrap low
|
|
415
415
|
always @(*) begin
|
|
416
|
-
OUT
|
|
417
|
-
POUT
|
|
416
|
+
OUT = (count == 8'h0);
|
|
417
|
+
POUT = count;
|
|
418
418
|
end
|
|
419
419
|
|
|
420
420
|
//POR or SYSRST reset value is COUNT_TO. Datasheet is unclear but conversations w/ Silego confirm.
|
|
@@ -488,23 +488,23 @@ module GP_DCMPMUX(input[1:0] SEL, input[7:0] IN0, input[7:0] IN1, input[7:0] IN2
|
|
|
488
488
|
always @(*) begin
|
|
489
489
|
case(SEL)
|
|
490
490
|
2'd00: begin
|
|
491
|
-
OUTA
|
|
492
|
-
OUTB
|
|
491
|
+
OUTA = IN0;
|
|
492
|
+
OUTB = IN3;
|
|
493
493
|
end
|
|
494
494
|
|
|
495
495
|
2'd01: begin
|
|
496
|
-
OUTA
|
|
497
|
-
OUTB
|
|
496
|
+
OUTA = IN1;
|
|
497
|
+
OUTB = IN2;
|
|
498
498
|
end
|
|
499
499
|
|
|
500
500
|
2'd02: begin
|
|
501
|
-
OUTA
|
|
502
|
-
OUTB
|
|
501
|
+
OUTA = IN2;
|
|
502
|
+
OUTB = IN1;
|
|
503
503
|
end
|
|
504
504
|
|
|
505
505
|
2'd03: begin
|
|
506
|
-
OUTA
|
|
507
|
-
OUTB
|
|
506
|
+
OUTA = IN3;
|
|
507
|
+
OUTB = IN0;
|
|
508
508
|
end
|
|
509
509
|
|
|
510
510
|
endcase
|
|
@@ -635,7 +635,7 @@ module GP_DLATCH(input D, input nCLK, output reg Q);
|
|
|
635
635
|
initial Q = INIT;
|
|
636
636
|
always @(*) begin
|
|
637
637
|
if(!nCLK)
|
|
638
|
-
Q
|
|
638
|
+
Q = D;
|
|
639
639
|
end
|
|
640
640
|
endmodule
|
|
641
641
|
|
|
@@ -644,7 +644,7 @@ module GP_DLATCHI(input D, input nCLK, output reg nQ);
|
|
|
644
644
|
initial nQ = INIT;
|
|
645
645
|
always @(*) begin
|
|
646
646
|
if(!nCLK)
|
|
647
|
-
nQ
|
|
647
|
+
nQ = ~D;
|
|
648
648
|
end
|
|
649
649
|
endmodule
|
|
650
650
|
|
|
@@ -653,9 +653,9 @@ module GP_DLATCHR(input D, input nCLK, input nRST, output reg Q);
|
|
|
653
653
|
initial Q = INIT;
|
|
654
654
|
always @(*) begin
|
|
655
655
|
if(!nRST)
|
|
656
|
-
Q
|
|
656
|
+
Q = 1'b0;
|
|
657
657
|
else if(!nCLK)
|
|
658
|
-
Q
|
|
658
|
+
Q = D;
|
|
659
659
|
end
|
|
660
660
|
endmodule
|
|
661
661
|
|
|
@@ -664,9 +664,9 @@ module GP_DLATCHRI(input D, input nCLK, input nRST, output reg nQ);
|
|
|
664
664
|
initial nQ = INIT;
|
|
665
665
|
always @(*) begin
|
|
666
666
|
if(!nRST)
|
|
667
|
-
nQ
|
|
667
|
+
nQ = 1'b1;
|
|
668
668
|
else if(!nCLK)
|
|
669
|
-
nQ
|
|
669
|
+
nQ = ~D;
|
|
670
670
|
end
|
|
671
671
|
endmodule
|
|
672
672
|
|
|
@@ -675,9 +675,9 @@ module GP_DLATCHS(input D, input nCLK, input nSET, output reg Q);
|
|
|
675
675
|
initial Q = INIT;
|
|
676
676
|
always @(*) begin
|
|
677
677
|
if(!nSET)
|
|
678
|
-
Q
|
|
678
|
+
Q = 1'b1;
|
|
679
679
|
else if(!nCLK)
|
|
680
|
-
Q
|
|
680
|
+
Q = D;
|
|
681
681
|
end
|
|
682
682
|
endmodule
|
|
683
683
|
|
|
@@ -686,9 +686,9 @@ module GP_DLATCHSI(input D, input nCLK, input nSET, output reg nQ);
|
|
|
686
686
|
initial nQ = INIT;
|
|
687
687
|
always @(*) begin
|
|
688
688
|
if(!nSET)
|
|
689
|
-
nQ
|
|
689
|
+
nQ = 1'b0;
|
|
690
690
|
else if(!nCLK)
|
|
691
|
-
nQ
|
|
691
|
+
nQ = ~D;
|
|
692
692
|
end
|
|
693
693
|
endmodule
|
|
694
694
|
|
|
@@ -698,9 +698,9 @@ module GP_DLATCHSR(input D, input nCLK, input nSR, output reg Q);
|
|
|
698
698
|
initial Q = INIT;
|
|
699
699
|
always @(*) begin
|
|
700
700
|
if(!nSR)
|
|
701
|
-
Q
|
|
701
|
+
Q = SRMODE;
|
|
702
702
|
else if(!nCLK)
|
|
703
|
-
Q
|
|
703
|
+
Q = D;
|
|
704
704
|
end
|
|
705
705
|
endmodule
|
|
706
706
|
|
|
@@ -710,9 +710,9 @@ module GP_DLATCHSRI(input D, input nCLK, input nSR, output reg nQ);
|
|
|
710
710
|
initial nQ = INIT;
|
|
711
711
|
always @(*) begin
|
|
712
712
|
if(!nSR)
|
|
713
|
-
nQ
|
|
713
|
+
nQ = ~SRMODE;
|
|
714
714
|
else if(!nCLK)
|
|
715
|
-
nQ
|
|
715
|
+
nQ = ~D;
|
|
716
716
|
end
|
|
717
717
|
endmodule
|
|
718
718
|
|
|
@@ -200,6 +200,10 @@ enum cxxrtl_flag {
|
|
|
200
200
|
// node, such as inputs and dangling wires.
|
|
201
201
|
CXXRTL_UNDRIVEN = 1 << 4,
|
|
202
202
|
|
|
203
|
+
// Generated correspond to netlist nodes that correspond to state with an internal name, that
|
|
204
|
+
// need to be saved, but wouldn't otherwise have a debug item generated.
|
|
205
|
+
CXXRTL_GENERATED = 1 << 5,
|
|
206
|
+
|
|
203
207
|
// More object flags may be added in the future, but the existing ones will never change.
|
|
204
208
|
};
|
|
205
209
|
|
|
@@ -498,6 +498,11 @@ struct value : public expr_base<value<Bits>> {
|
|
|
498
498
|
return result;
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
+
CXXRTL_ALWAYS_INLINE
|
|
502
|
+
value<Bits> bwmux(const value<Bits> &b, const value<Bits> &s) const {
|
|
503
|
+
return (bit_and(s.bit_not())).bit_or(b.bit_and(s));
|
|
504
|
+
}
|
|
505
|
+
|
|
501
506
|
template<size_t ResultBits, size_t SelBits>
|
|
502
507
|
value<ResultBits> demux(const value<SelBits> &sel) const {
|
|
503
508
|
static_assert(Bits << SelBits == ResultBits, "invalid sizes used in demux()");
|
|
@@ -1289,6 +1294,7 @@ struct debug_item : ::cxxrtl_object {
|
|
|
1289
1294
|
DRIVEN_SYNC = CXXRTL_DRIVEN_SYNC,
|
|
1290
1295
|
DRIVEN_COMB = CXXRTL_DRIVEN_COMB,
|
|
1291
1296
|
UNDRIVEN = CXXRTL_UNDRIVEN,
|
|
1297
|
+
GENERATED = CXXRTL_GENERATED,
|
|
1292
1298
|
};
|
|
1293
1299
|
|
|
1294
1300
|
debug_item(const ::cxxrtl_object &object) : cxxrtl_object(object) {}
|
|
@@ -1764,7 +1770,7 @@ value<BitsY> shr_uu(const value<BitsA> &a, const value<BitsB> &b) {
|
|
|
1764
1770
|
template<size_t BitsY, size_t BitsA, size_t BitsB>
|
|
1765
1771
|
CXXRTL_ALWAYS_INLINE
|
|
1766
1772
|
value<BitsY> shr_su(const value<BitsA> &a, const value<BitsB> &b) {
|
|
1767
|
-
return a.
|
|
1773
|
+
return a.template scast<BitsY>().shr(b);
|
|
1768
1774
|
}
|
|
1769
1775
|
|
|
1770
1776
|
template<size_t BitsY, size_t BitsA, size_t BitsB>
|
|
@@ -2005,7 +2011,7 @@ std::pair<value<BitsY>, value<BitsY>> divmod_uu(const value<BitsA> &a, const val
|
|
|
2005
2011
|
value<Bits> quotient;
|
|
2006
2012
|
value<Bits> remainder;
|
|
2007
2013
|
value<Bits> dividend = a.template zext<Bits>();
|
|
2008
|
-
value<Bits> divisor
|
|
2014
|
+
value<Bits> divisor = b.template trunc<BitsB>().template zext<Bits>();
|
|
2009
2015
|
std::tie(quotient, remainder) = dividend.udivmod(divisor);
|
|
2010
2016
|
return {quotient.template trunc<BitsY>(), remainder.template trunc<BitsY>()};
|
|
2011
2017
|
}
|
|
@@ -153,6 +153,7 @@ X(parameter)
|
|
|
153
153
|
X(PORTID)
|
|
154
154
|
X(PRIORITY)
|
|
155
155
|
X(PRIORITY_MASK)
|
|
156
|
+
X(promoted_if)
|
|
156
157
|
X(Q)
|
|
157
158
|
X(R)
|
|
158
159
|
X(ram_block)
|
|
@@ -184,6 +185,7 @@ X(romstyle)
|
|
|
184
185
|
X(S)
|
|
185
186
|
X(SET)
|
|
186
187
|
X(SET_POLARITY)
|
|
188
|
+
X(single_bit_vector)
|
|
187
189
|
X(SIZE)
|
|
188
190
|
X(SRC)
|
|
189
191
|
X(src)
|
|
@@ -64,6 +64,23 @@ inline std::string stringf(const char *fmt, ...)
|
|
|
64
64
|
return string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
int readsome(std::istream &f, char *s, int n);
|
|
68
|
+
std::string next_token(std::string &text, const char *sep = " \t\r\n", bool long_strings = false);
|
|
69
|
+
std::vector<std::string> split_tokens(const std::string &text, const char *sep = " \t\r\n");
|
|
70
|
+
bool patmatch(const char *pattern, const char *string);
|
|
71
|
+
#if !defined(YOSYS_DISABLE_SPAWN)
|
|
72
|
+
int run_command(const std::string &command, std::function<void(const std::string&)> process_line = std::function<void(const std::string&)>());
|
|
73
|
+
#endif
|
|
74
|
+
std::string get_base_tmpdir();
|
|
75
|
+
std::string make_temp_file(std::string template_str = get_base_tmpdir() + "/yosys_XXXXXX");
|
|
76
|
+
std::string make_temp_dir(std::string template_str = get_base_tmpdir() + "/yosys_XXXXXX");
|
|
77
|
+
bool check_file_exists(const std::string& filename, bool is_exec = false);
|
|
78
|
+
bool check_directory_exists(const std::string& dirname, bool is_exec = false);
|
|
79
|
+
bool is_absolute_path(std::string filename);
|
|
80
|
+
void remove_directory(std::string dirname);
|
|
81
|
+
bool create_directory(const std::string& dirname);
|
|
82
|
+
std::string escape_filename_spaces(const std::string& filename);
|
|
83
|
+
|
|
67
84
|
YOSYS_NAMESPACE_END
|
|
68
85
|
|
|
69
86
|
#endif // YOSYS_IO_H
|
|
@@ -26,18 +26,18 @@ YOSYS_NAMESPACE_BEGIN
|
|
|
26
26
|
|
|
27
27
|
struct Macc
|
|
28
28
|
{
|
|
29
|
-
struct
|
|
29
|
+
struct term_t {
|
|
30
30
|
RTLIL::SigSpec in_a, in_b;
|
|
31
31
|
bool is_signed, do_subtract;
|
|
32
32
|
};
|
|
33
|
-
std::vector<
|
|
33
|
+
std::vector<term_t> terms;
|
|
34
34
|
|
|
35
35
|
void optimize(int width)
|
|
36
36
|
{
|
|
37
|
-
std::vector<
|
|
37
|
+
std::vector<term_t> new_terms;
|
|
38
38
|
RTLIL::Const off(0, width);
|
|
39
39
|
|
|
40
|
-
for (auto &port :
|
|
40
|
+
for (auto &port : terms)
|
|
41
41
|
{
|
|
42
42
|
if (GetSize(port.in_a) == 0 && GetSize(port.in_b) == 0)
|
|
43
43
|
continue;
|
|
@@ -68,25 +68,25 @@ struct Macc
|
|
|
68
68
|
port.in_b.remove(GetSize(port.in_b)-1);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
new_terms.push_back(port);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (off.as_bool()) {
|
|
75
|
-
|
|
75
|
+
term_t port;
|
|
76
76
|
port.in_a = off;
|
|
77
77
|
port.is_signed = false;
|
|
78
78
|
port.do_subtract = false;
|
|
79
|
-
|
|
79
|
+
new_terms.push_back(port);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
new_terms.swap(terms);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
void from_cell_v1(RTLIL::Cell *cell)
|
|
86
86
|
{
|
|
87
87
|
RTLIL::SigSpec port_a = cell->getPort(ID::A);
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
terms.clear();
|
|
90
90
|
|
|
91
91
|
auto config_bits = cell->getParam(ID::CONFIG);
|
|
92
92
|
int config_cursor = 0;
|
|
@@ -105,7 +105,7 @@ struct Macc
|
|
|
105
105
|
{
|
|
106
106
|
log_assert(config_cursor + 2 + 2*num_bits <= config_width);
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
term_t this_port;
|
|
109
109
|
this_port.is_signed = config_bits[config_cursor++] == State::S1;
|
|
110
110
|
this_port.do_subtract = config_bits[config_cursor++] == State::S1;
|
|
111
111
|
|
|
@@ -126,11 +126,11 @@ struct Macc
|
|
|
126
126
|
port_a_cursor += size_b;
|
|
127
127
|
|
|
128
128
|
if (size_a || size_b)
|
|
129
|
-
|
|
129
|
+
terms.push_back(this_port);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
for (auto bit : cell->getPort(ID::B))
|
|
133
|
-
|
|
133
|
+
terms.push_back(term_t{{bit}, {}, false, false});
|
|
134
134
|
|
|
135
135
|
log_assert(config_cursor == config_width);
|
|
136
136
|
log_assert(port_a_cursor == GetSize(port_a));
|
|
@@ -148,7 +148,7 @@ struct Macc
|
|
|
148
148
|
RTLIL::SigSpec port_b = cell->getPort(ID::B);
|
|
149
149
|
RTLIL::SigSpec port_c = cell->getPort(ID::C);
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
terms.clear();
|
|
152
152
|
|
|
153
153
|
int nproducts = cell->getParam(ID::NPRODUCTS).as_int();
|
|
154
154
|
const Const &product_neg = cell->getParam(ID::PRODUCT_NEGATED);
|
|
@@ -158,7 +158,7 @@ struct Macc
|
|
|
158
158
|
const Const &b_signed = cell->getParam(ID::B_SIGNED);
|
|
159
159
|
int ai = 0, bi = 0;
|
|
160
160
|
for (int i = 0; i < nproducts; i++) {
|
|
161
|
-
|
|
161
|
+
term_t term;
|
|
162
162
|
|
|
163
163
|
log_assert(a_signed[i] == b_signed[i]);
|
|
164
164
|
term.is_signed = (a_signed[i] == State::S1);
|
|
@@ -171,7 +171,7 @@ struct Macc
|
|
|
171
171
|
bi += b_width;
|
|
172
172
|
term.do_subtract = (product_neg[i] == State::S1);
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
terms.push_back(term);
|
|
175
175
|
}
|
|
176
176
|
log_assert(port_a.size() == ai);
|
|
177
177
|
log_assert(port_b.size() == bi);
|
|
@@ -182,7 +182,7 @@ struct Macc
|
|
|
182
182
|
const Const &c_signed = cell->getParam(ID::C_SIGNED);
|
|
183
183
|
int ci = 0;
|
|
184
184
|
for (int i = 0; i < naddends; i++) {
|
|
185
|
-
|
|
185
|
+
term_t term;
|
|
186
186
|
|
|
187
187
|
term.is_signed = (c_signed[i] == State::S1);
|
|
188
188
|
int c_width = c_widths.extract(16 * i, 16).as_int(false);
|
|
@@ -191,7 +191,7 @@ struct Macc
|
|
|
191
191
|
ci += c_width;
|
|
192
192
|
term.do_subtract = (addend_neg[i] == State::S1);
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
terms.push_back(term);
|
|
195
195
|
}
|
|
196
196
|
log_assert(port_c.size() == ci);
|
|
197
197
|
}
|
|
@@ -205,23 +205,23 @@ struct Macc
|
|
|
205
205
|
Const c_signed, c_widths, addend_negated;
|
|
206
206
|
SigSpec a, b, c;
|
|
207
207
|
|
|
208
|
-
for (int i = 0; i < (int)
|
|
209
|
-
SigSpec term_a =
|
|
208
|
+
for (int i = 0; i < (int) terms.size(); i++) {
|
|
209
|
+
SigSpec term_a = terms[i].in_a, term_b = terms[i].in_b;
|
|
210
210
|
|
|
211
211
|
if (term_b.empty()) {
|
|
212
212
|
// addend
|
|
213
213
|
c_widths.append(Const(term_a.size(), 16));
|
|
214
|
-
c_signed.append(
|
|
215
|
-
addend_negated.append(
|
|
214
|
+
c_signed.append(terms[i].is_signed ? RTLIL::S1 : RTLIL::S0);
|
|
215
|
+
addend_negated.append(terms[i].do_subtract ? RTLIL::S1 : RTLIL::S0);
|
|
216
216
|
c.append(term_a);
|
|
217
217
|
naddends++;
|
|
218
218
|
} else {
|
|
219
219
|
// product
|
|
220
220
|
a_widths.append(Const(term_a.size(), 16));
|
|
221
221
|
b_widths.append(Const(term_b.size(), 16));
|
|
222
|
-
a_signed.append(
|
|
223
|
-
b_signed.append(
|
|
224
|
-
product_negated.append(
|
|
222
|
+
a_signed.append(terms[i].is_signed ? RTLIL::S1 : RTLIL::S0);
|
|
223
|
+
b_signed.append(terms[i].is_signed ? RTLIL::S1 : RTLIL::S0);
|
|
224
|
+
product_negated.append(terms[i].do_subtract ? RTLIL::S1 : RTLIL::S0);
|
|
225
225
|
a.append(term_a);
|
|
226
226
|
b.append(term_b);
|
|
227
227
|
nproducts++;
|
|
@@ -265,7 +265,7 @@ struct Macc
|
|
|
265
265
|
for (auto &bit : result.bits())
|
|
266
266
|
bit = State::S0;
|
|
267
267
|
|
|
268
|
-
for (auto &port :
|
|
268
|
+
for (auto &port : terms)
|
|
269
269
|
{
|
|
270
270
|
if (!port.in_a.is_fully_const() || !port.in_b.is_fully_const())
|
|
271
271
|
return false;
|
|
@@ -287,9 +287,9 @@ struct Macc
|
|
|
287
287
|
|
|
288
288
|
bool is_simple_product()
|
|
289
289
|
{
|
|
290
|
-
return
|
|
291
|
-
!
|
|
292
|
-
!
|
|
290
|
+
return terms.size() == 1 &&
|
|
291
|
+
!terms[0].in_b.empty() &&
|
|
292
|
+
!terms[0].do_subtract;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
Macc(RTLIL::Cell *cell = nullptr)
|