yowasp-yosys 0.29.0.0.post524__py3-none-any.whl → 0.30.0.0.post538__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/__init__.py CHANGED
@@ -21,10 +21,23 @@ def _run_yosys_smtbmc_argv():
21
21
  sys.path[0:0] = [str(prefix / "share" / "python3")]
22
22
  smtbmc_py = prefix / "smtbmc.py"
23
23
  with open(smtbmc_py) as f:
24
- globals = {}
24
+ globals = {"__name__": "__main__"}
25
25
  exec(compile(f.read(), smtbmc_py, "exec"), globals, globals)
26
26
 
27
27
 
28
+ def _run_yosys_witness_argv():
29
+ prefix = importlib_resources.files(__package__)
30
+ sys.path[0:0] = [str(prefix / "share" / "python3")]
31
+ ywio_py = prefix / "ywio.py"
32
+ with open(ywio_py) as f:
33
+ globals = {}
34
+ exec(compile(f.read(), ywio_py, "exec"), globals, globals)
35
+ witness_py = prefix / "witness.py"
36
+ with open(witness_py) as f:
37
+ globals = {"__name__": "__main__"}
38
+ exec(compile(f.read(), witness_py, "exec"), globals, globals)
39
+
40
+
28
41
  def _run_sby_argv():
29
42
  prefix = importlib_resources.files(__package__)
30
43
  sys.path[0:0] = [str(prefix / "share" / "python3")]
@@ -131,70 +131,3 @@ module CC_USR_RSTN (
131
131
  output USR_RSTN
132
132
  );
133
133
  endmodule
134
-
135
- (* blackbox *)
136
- module CC_FIFO_40K (
137
- output A_ECC_1B_ERR,
138
- output B_ECC_1B_ERR,
139
- output A_ECC_2B_ERR,
140
- output B_ECC_2B_ERR,
141
- // FIFO pop port
142
- output [39:0] A_DO,
143
- output [39:0] B_DO,
144
- (* clkbuf_sink *)
145
- input A_CLK,
146
- input A_EN,
147
- // FIFO push port
148
- input [39:0] A_DI,
149
- input [39:0] B_DI,
150
- input [39:0] A_BM,
151
- input [39:0] B_BM,
152
- (* clkbuf_sink *)
153
- input B_CLK,
154
- input B_EN,
155
- input B_WE,
156
- // FIFO control
157
- input F_RST_N,
158
- input [12:0] F_ALMOST_FULL_OFFSET,
159
- input [12:0] F_ALMOST_EMPTY_OFFSET,
160
- // FIFO status signals
161
- output F_FULL,
162
- output F_EMPTY,
163
- output F_ALMOST_FULL,
164
- output F_ALMOST_EMPTY,
165
- output F_RD_ERROR,
166
- output F_WR_ERROR,
167
- output [15:0] F_RD_PTR,
168
- output [15:0] F_WR_PTR
169
- );
170
- // Location format: D(0..N-1)X(0..3)Y(0..7) or UNPLACED
171
- parameter LOC = "UNPLACED";
172
-
173
- // Offset configuration
174
- parameter [12:0] ALMOST_FULL_OFFSET = 12'b0;
175
- parameter [12:0] ALMOST_EMPTY_OFFSET = 12'b0;
176
-
177
- // Port Widths
178
- parameter A_WIDTH = 0;
179
- parameter B_WIDTH = 0;
180
-
181
- // RAM and Write Modes
182
- parameter RAM_MODE = "SDP"; // "TPD" or "SDP"
183
- parameter FIFO_MODE = "SYNC"; // "ASYNC" or "SYNC"
184
-
185
- // Inverting Control Pins
186
- parameter A_CLK_INV = 1'b0;
187
- parameter B_CLK_INV = 1'b0;
188
- parameter A_EN_INV = 1'b0;
189
- parameter B_EN_INV = 1'b0;
190
- parameter A_WE_INV = 1'b0;
191
- parameter B_WE_INV = 1'b0;
192
-
193
- // Output Register
194
- parameter A_DO_REG = 1'b0;
195
- parameter B_DO_REG = 1'b0;
196
-
197
- // Error Checking and Correction
198
- parameter A_ECC_EN = 1'b0;
199
- parameter B_ECC_EN = 1'b0;
200
- endmodule
@@ -733,13 +733,12 @@ module CC_BRAM_20K (
733
733
  // SDP read port
734
734
  always @(posedge clkb)
735
735
  begin
736
- // "NO_CHANGE" only
737
736
  for (k=0; k < B_RD_WIDTH; k=k+1) begin
738
737
  if (k < 20) begin
739
- if (enb && !wea) A_DO_out[k] <= memory[addrb+k];
738
+ if (enb) A_DO_out[k] <= memory[addrb+k];
740
739
  end
741
740
  else begin // use both ports
742
- if (enb && !wea) B_DO_out[k-20] <= memory[addrb+k];
741
+ if (enb) B_DO_out[k-20] <= memory[addrb+k];
743
742
  end
744
743
  end
745
744
  end
@@ -1274,13 +1273,12 @@ module CC_BRAM_40K (
1274
1273
  // SDP read port
1275
1274
  always @(posedge clkb)
1276
1275
  begin
1277
- // "NO_CHANGE" only
1278
1276
  for (k=0; k < B_RD_WIDTH; k=k+1) begin
1279
1277
  if (k < 40) begin
1280
- if (enb && !wea) A_DO_out[k] <= memory[addrb+k];
1278
+ if (enb) A_DO_out[k] <= memory[addrb+k];
1281
1279
  end
1282
1280
  else begin // use both ports
1283
- if (enb && !wea) B_DO_out[k-40] <= memory[addrb+k];
1281
+ if (enb) B_DO_out[k-40] <= memory[addrb+k];
1284
1282
  end
1285
1283
  end
1286
1284
  end
@@ -1412,6 +1410,393 @@ module CC_BRAM_40K (
1412
1410
  endgenerate
1413
1411
  endmodule
1414
1412
 
1413
+ module CC_FIFO_40K (
1414
+ output A_ECC_1B_ERR,
1415
+ output B_ECC_1B_ERR,
1416
+ output A_ECC_2B_ERR,
1417
+ output B_ECC_2B_ERR,
1418
+ // FIFO pop port
1419
+ output [39:0] A_DO,
1420
+ output [39:0] B_DO,
1421
+ (* clkbuf_sink *)
1422
+ input A_CLK,
1423
+ input A_EN,
1424
+ // FIFO push port
1425
+ input [39:0] A_DI,
1426
+ input [39:0] B_DI,
1427
+ input [39:0] A_BM,
1428
+ input [39:0] B_BM,
1429
+ (* clkbuf_sink *)
1430
+ input B_CLK,
1431
+ input B_EN,
1432
+ input B_WE,
1433
+ // FIFO control
1434
+ input F_RST_N,
1435
+ input [14:0] F_ALMOST_FULL_OFFSET,
1436
+ input [14:0] F_ALMOST_EMPTY_OFFSET,
1437
+ // FIFO status signals
1438
+ output F_FULL,
1439
+ output F_EMPTY,
1440
+ output F_ALMOST_FULL,
1441
+ output F_ALMOST_EMPTY,
1442
+ output F_RD_ERROR,
1443
+ output F_WR_ERROR,
1444
+ output [15:0] F_RD_PTR,
1445
+ output [15:0] F_WR_PTR
1446
+ );
1447
+ // Location format: D(0..N-1)X(0..3)Y(0..7) or UNPLACED
1448
+ parameter LOC = "UNPLACED";
1449
+
1450
+ // Offset configuration
1451
+ parameter DYN_STAT_SELECT = 1'b0;
1452
+ parameter [14:0] ALMOST_FULL_OFFSET = 15'b0;
1453
+ parameter [14:0] ALMOST_EMPTY_OFFSET = 15'b0;
1454
+
1455
+ // Port Widths
1456
+ parameter A_WIDTH = 0;
1457
+ parameter B_WIDTH = 0;
1458
+
1459
+ // RAM and Write Modes
1460
+ parameter RAM_MODE = "TDP"; // "TDP" or "SDP"
1461
+ parameter FIFO_MODE = "SYNC"; // "ASYNC" or "SYNC"
1462
+
1463
+ // Inverting Control Pins
1464
+ parameter A_CLK_INV = 1'b0;
1465
+ parameter B_CLK_INV = 1'b0;
1466
+ parameter A_EN_INV = 1'b0;
1467
+ parameter B_EN_INV = 1'b0;
1468
+ parameter A_WE_INV = 1'b0;
1469
+ parameter B_WE_INV = 1'b0;
1470
+
1471
+ // Output Register
1472
+ parameter A_DO_REG = 1'b0;
1473
+ parameter B_DO_REG = 1'b0;
1474
+
1475
+ // Error Checking and Correction
1476
+ parameter A_ECC_EN = 1'b0;
1477
+ parameter B_ECC_EN = 1'b0;
1478
+
1479
+ integer i, k;
1480
+
1481
+ // 512 x 80 bit
1482
+ reg [40959:0] memory = 40960'b0;
1483
+
1484
+ reg [15:0] counter_max;
1485
+ reg [15:0] sram_depth;
1486
+ localparam tp = (A_WIDTH == 1) ? 15 :
1487
+ (A_WIDTH == 2) ? 14 :
1488
+ (A_WIDTH == 5) ? 13 :
1489
+ (A_WIDTH == 10) ? 12 :
1490
+ (A_WIDTH == 20) ? 11 :
1491
+ (A_WIDTH == 40) ? 10 : 9;
1492
+
1493
+ initial begin
1494
+ // Check parameters
1495
+ if ((RAM_MODE != "SDP") && (RAM_MODE != "TDP")) begin
1496
+ $display("ERROR: Illegal RAM MODE %d.", RAM_MODE);
1497
+ $finish();
1498
+ end
1499
+ if ((FIFO_MODE != "ASYNC") && (FIFO_MODE != "SYNC")) begin
1500
+ $display("ERROR: Illegal FIFO MODE %d.", FIFO_MODE);
1501
+ $finish();
1502
+ end
1503
+ if ((RAM_MODE == "SDP") && (DYN_STAT_SELECT == 1)) begin
1504
+ $display("ERROR: Dynamic offset configuration is not supported in %s mode.", RAM_MODE);
1505
+ $finish();
1506
+ end
1507
+ if ((RAM_MODE == "SDP") && ((A_WIDTH != 80) || (B_WIDTH != 80))) begin
1508
+ $display("ERROR: SDP is ony supported in 80 bit mode.");
1509
+ $finish();
1510
+ end
1511
+ if ((A_WIDTH == 80) && (RAM_MODE == "TDP")) begin
1512
+ $display("ERROR: Port A width of 80 bits is only supported in SDP mode.");
1513
+ $finish();
1514
+ end
1515
+ if ((B_WIDTH == 80) && (RAM_MODE == "TDP")) begin
1516
+ $display("ERROR: Port B width of 80 bits is only supported in SDP mode.");
1517
+ $finish();
1518
+ end
1519
+ if ((A_WIDTH != 80) && (A_WIDTH != 40) && (A_WIDTH != 20) && (A_WIDTH != 10) &&
1520
+ (A_WIDTH != 5) && (A_WIDTH != 2) && (A_WIDTH != 1) && (A_WIDTH != 0)) begin
1521
+ $display("ERROR: Illegal %s Port A width configuration %d.", RAM_MODE, A_WIDTH);
1522
+ $finish();
1523
+ end
1524
+ if ((B_WIDTH != 80) && (B_WIDTH != 40) && (B_WIDTH != 20) && (B_WIDTH != 10) &&
1525
+ (B_WIDTH != 5) && (B_WIDTH != 2) && (B_WIDTH != 1) && (B_WIDTH != 0)) begin
1526
+ $display("ERROR: Illegal %s Port B width configuration %d.", RAM_MODE, B_WIDTH);
1527
+ $finish();
1528
+ end
1529
+ if (A_WIDTH != B_WIDTH) begin
1530
+ $display("ERROR: The values of A_WIDTH and B_WIDTH must be equal.");
1531
+ end
1532
+ if ((A_ECC_EN == 1'b1) && (RAM_MODE != "SDP") && (A_WIDTH != 40)) begin
1533
+ $display("ERROR: Illegal ECC Port A configuration. ECC mode requires TDP >=40 bit or SDP 80 bit, but is %s %d.", RAM_MODE, A_WIDTH);
1534
+ $finish();
1535
+ end
1536
+ // Set local parameters
1537
+ if (A_WIDTH == 1) begin // A_WIDTH=B_WIDTH
1538
+ counter_max = 2 * 32*1024 - 1;
1539
+ sram_depth = 32*1024;
1540
+ end
1541
+ else if (A_WIDTH == 2) begin
1542
+ counter_max = 2 * 16*1024 - 1;
1543
+ sram_depth = 16*1024;
1544
+ end
1545
+ else if (A_WIDTH == 5) begin
1546
+ counter_max = 2 * 8*1024 - 1;
1547
+ sram_depth = 8*1024;
1548
+ end
1549
+ else if (A_WIDTH == 10) begin
1550
+ counter_max = 2 * 4*1024 - 1;
1551
+ sram_depth = 4*1024;
1552
+ end
1553
+ else if (A_WIDTH == 20) begin
1554
+ counter_max = 2 * 2*1024 - 1;
1555
+ sram_depth = 2*1024;
1556
+ end
1557
+ else if (A_WIDTH == 40) begin
1558
+ counter_max = 2 * 1*1024 - 1;
1559
+ sram_depth = 1*1024;
1560
+ end
1561
+ else begin // 80 bit SDP
1562
+ counter_max = 2 * 512 - 1;
1563
+ sram_depth = 512;
1564
+ end
1565
+ end
1566
+
1567
+ // Internal signals
1568
+ wire fifo_rdclk = A_CLK ^ A_CLK_INV;
1569
+ wire fifo_wrclk = (FIFO_MODE == "ASYNC") ? (B_CLK ^ B_CLK_INV) : (A_CLK ^ A_CLK_INV);
1570
+ wire [15:0] almost_full_offset = DYN_STAT_SELECT ? F_ALMOST_FULL_OFFSET : ALMOST_FULL_OFFSET;
1571
+ wire [15:0] almost_empty_offset = DYN_STAT_SELECT ? F_ALMOST_EMPTY_OFFSET : ALMOST_EMPTY_OFFSET;
1572
+ reg [39:0] A_DO_out = 0, A_DO_reg = 0;
1573
+ reg [39:0] B_DO_out = 0, B_DO_reg = 0;
1574
+
1575
+ // Status signals
1576
+ reg fifo_full;
1577
+ reg fifo_empty;
1578
+ reg fifo_almost_full;
1579
+ reg fifo_almost_empty;
1580
+ assign F_FULL = fifo_full;
1581
+ assign F_EMPTY = fifo_empty;
1582
+ assign F_ALMOST_FULL = fifo_almost_full;
1583
+ assign F_ALMOST_EMPTY = fifo_almost_empty;
1584
+ assign F_WR_ERROR = (F_FULL && (B_EN ^ B_EN_INV) && (B_WE ^ B_WE_INV));
1585
+ assign F_RD_ERROR = (F_EMPTY && (A_EN ^ A_EN_INV));
1586
+ wire ram_we = (~F_FULL && (B_EN ^ B_EN_INV) && (B_WE ^ B_WE_INV));
1587
+ wire ram_en = (~F_EMPTY && (A_EN ^ A_EN_INV));
1588
+
1589
+ // Reset synchronizers
1590
+ reg [1:0] aclk_reset_q, bclk_reset_q;
1591
+ wire fifo_sync_rstn = aclk_reset_q;
1592
+ wire fifo_async_wrrstn = bclk_reset_q;
1593
+ wire fifo_async_rdrstn = aclk_reset_q;
1594
+
1595
+ always @(posedge fifo_rdclk or negedge F_RST_N)
1596
+ begin
1597
+ if (F_RST_N == 1'b0) begin
1598
+ aclk_reset_q <= 2'b0;
1599
+ end
1600
+ else begin
1601
+ aclk_reset_q[1] <= aclk_reset_q[0];
1602
+ aclk_reset_q[0] <= 1'b1;
1603
+ end
1604
+ end
1605
+
1606
+ always @(posedge fifo_wrclk or negedge F_RST_N)
1607
+ begin
1608
+ if (F_RST_N == 1'b0) begin
1609
+ bclk_reset_q <= 2'b0;
1610
+ end
1611
+ else begin
1612
+ bclk_reset_q[1] <= bclk_reset_q[0];
1613
+ bclk_reset_q[0] <= 1'b1;
1614
+ end
1615
+ end
1616
+
1617
+ // Push/pop pointers
1618
+ reg [15:0] rd_pointer, rd_pointer_int;
1619
+ reg [15:0] wr_pointer, wr_pointer_int;
1620
+ reg [15:0] rd_pointer_cmp, wr_pointer_cmp;
1621
+ wire [15:0] rd_pointer_nxt;
1622
+ wire [15:0] wr_pointer_nxt;
1623
+ reg [15:0] fifo_rdaddr, rdaddr;
1624
+ reg [15:0] fifo_wraddr, wraddr;
1625
+ assign F_RD_PTR = fifo_rdaddr;
1626
+ assign F_WR_PTR = fifo_wraddr;
1627
+
1628
+ always @(posedge fifo_rdclk or negedge F_RST_N)
1629
+ begin
1630
+ if (F_RST_N == 1'b0) begin
1631
+ rd_pointer <= 0;
1632
+ rd_pointer_int <= 0;
1633
+ end
1634
+ else if (ram_en) begin
1635
+ rd_pointer <= rd_pointer_nxt;
1636
+ rd_pointer_int <= rd_pointer_nxt[15:1] ^ rd_pointer_nxt[14:0];
1637
+ end
1638
+ end
1639
+
1640
+ assign rd_pointer_nxt = (rd_pointer == counter_max) ? (0) : (rd_pointer + 1'b1);
1641
+
1642
+ always @(posedge fifo_wrclk or negedge F_RST_N)
1643
+ begin
1644
+ if (F_RST_N == 1'b0) begin
1645
+ wr_pointer <= 0;
1646
+ wr_pointer_int <= 0;
1647
+ end
1648
+ else if (ram_we) begin
1649
+ wr_pointer <= wr_pointer_nxt;
1650
+ wr_pointer_int <= wr_pointer_nxt[15:1] ^ wr_pointer_nxt[14:0];
1651
+ end
1652
+ end
1653
+
1654
+ assign wr_pointer_nxt = (wr_pointer == counter_max) ? (0) : (wr_pointer + 1'b1);
1655
+
1656
+ // Address synchronizers
1657
+ reg [15:0] rd_pointer_sync, wr_pointer_sync;
1658
+ reg [15:0] rd_pointer_sync_0, rd_pointer_sync_1;
1659
+ reg [15:0] wr_pointer_sync_0, wr_pointer_sync_1;
1660
+
1661
+ always @(posedge fifo_rdclk or negedge F_RST_N)
1662
+ begin
1663
+ if (F_RST_N == 1'b0) begin
1664
+ wr_pointer_sync_0 <= 0;
1665
+ wr_pointer_sync_1 <= 0;
1666
+ end
1667
+ else begin
1668
+ wr_pointer_sync_0 <= wraddr;
1669
+ wr_pointer_sync_1 <= wr_pointer_sync_0;
1670
+ end
1671
+ end
1672
+
1673
+ always @(posedge fifo_wrclk or negedge F_RST_N)
1674
+ begin
1675
+ if (F_RST_N == 1'b0) begin
1676
+ rd_pointer_sync_0 <= 0;
1677
+ rd_pointer_sync_1 <= 0;
1678
+ end
1679
+ else begin
1680
+ rd_pointer_sync_0 <= rdaddr;
1681
+ rd_pointer_sync_1 <= rd_pointer_sync_0;
1682
+ end
1683
+ end
1684
+
1685
+ always @(*) begin
1686
+ fifo_wraddr = {wr_pointer[tp-1:0], {(15-tp){1'b0}}};
1687
+ fifo_rdaddr = {rd_pointer[tp-1:0], {(15-tp){1'b0}}};
1688
+
1689
+ rdaddr = {rd_pointer[tp], rd_pointer_int[tp-1:0]};
1690
+ wraddr = {{(15-tp){1'b0}}, wr_pointer[tp], wr_pointer_int[tp:0]};
1691
+
1692
+ if (FIFO_MODE == "ASYNC")
1693
+ fifo_full = (wraddr[tp-2:0] == rd_pointer_sync_1[tp-2:0] ) && (wraddr[tp] != rd_pointer_sync_1[tp] ) && ( wraddr[tp-1] != rd_pointer_sync_1[tp-1] );
1694
+ else
1695
+ fifo_full = (wr_pointer[tp-1:0] == rd_pointer[tp-1:0]) && (wr_pointer[tp] ^ rd_pointer[tp]);
1696
+
1697
+ if (FIFO_MODE == "ASYNC")
1698
+ fifo_empty = (wr_pointer_sync_1[tp:0] == rdaddr[tp:0]);
1699
+ else
1700
+ fifo_empty = (wr_pointer[tp:0] == rd_pointer[tp:0]);
1701
+
1702
+ rd_pointer_cmp = (FIFO_MODE == "ASYNC") ? rd_pointer_sync : rd_pointer;
1703
+ if (wr_pointer[tp] == rd_pointer_cmp[tp])
1704
+ fifo_almost_full = ((wr_pointer[tp-1:0] - rd_pointer_cmp[tp-1:0]) >= (sram_depth - almost_full_offset));
1705
+ else
1706
+ fifo_almost_full = ((rd_pointer_cmp[tp-1:0] - wr_pointer[tp-1:0]) <= almost_full_offset);
1707
+
1708
+ wr_pointer_cmp = (FIFO_MODE == "ASYNC") ? wr_pointer_sync : wr_pointer;
1709
+ if (wr_pointer_cmp[tp] == rd_pointer[tp])
1710
+ fifo_almost_empty = ((wr_pointer_cmp[tp-1:0] - rd_pointer[tp-1:0]) <= almost_empty_offset);
1711
+ else
1712
+ fifo_almost_empty = ((rd_pointer[tp-1:0] - wr_pointer_cmp[tp-1:0]) >= (sram_depth - almost_empty_offset));
1713
+ end
1714
+
1715
+ generate
1716
+ always @(*) begin
1717
+ wr_pointer_sync = 0;
1718
+ rd_pointer_sync = 0;
1719
+ for (i=tp; i >= 0; i=i-1) begin
1720
+ if (i == tp) begin
1721
+ wr_pointer_sync[i] = wr_pointer_sync_1[i];
1722
+ rd_pointer_sync[i] = rd_pointer_sync_1[i];
1723
+ end
1724
+ else begin
1725
+ wr_pointer_sync[i] = wr_pointer_sync_1[i] ^ wr_pointer_sync[i+1];
1726
+ rd_pointer_sync[i] = rd_pointer_sync_1[i] ^ rd_pointer_sync[i+1];
1727
+ end
1728
+ end
1729
+ end
1730
+ if (RAM_MODE == "SDP") begin
1731
+ // SDP push ports A+B
1732
+ always @(posedge fifo_wrclk)
1733
+ begin
1734
+ for (k=0; k < A_WIDTH; k=k+1) begin
1735
+ if (k < 40) begin
1736
+ if (ram_we && A_BM[k]) memory[fifo_wraddr+k] <= A_DI[k];
1737
+ end
1738
+ else begin // use both ports
1739
+ if (ram_we && B_BM[k-40]) memory[fifo_wraddr+k] <= B_DI[k-40];
1740
+ end
1741
+ end
1742
+ end
1743
+ // SDP pop ports A+B
1744
+ always @(posedge fifo_rdclk)
1745
+ begin
1746
+ for (k=0; k < B_WIDTH; k=k+1) begin
1747
+ if (k < 40) begin
1748
+ if (ram_en) A_DO_out[k] <= memory[fifo_rdaddr+k];
1749
+ end
1750
+ else begin // use both ports
1751
+ if (ram_en) B_DO_out[k-40] <= memory[fifo_rdaddr+k];
1752
+ end
1753
+ end
1754
+ end
1755
+ end
1756
+ else if (RAM_MODE == "TDP") begin
1757
+ // TDP pop port A
1758
+ always @(posedge fifo_rdclk)
1759
+ begin
1760
+ for (i=0; i < A_WIDTH; i=i+1) begin
1761
+ if (ram_en) begin
1762
+ A_DO_out[i] <= memory[fifo_rdaddr+i];
1763
+ end
1764
+ end
1765
+ end
1766
+ // TDP push port B
1767
+ always @(posedge fifo_wrclk)
1768
+ begin
1769
+ for (i=0; i < B_WIDTH; i=i+1) begin
1770
+ if (ram_we && B_BM[i])
1771
+ memory[fifo_wraddr+i] <= B_DI[i];
1772
+ end
1773
+ end
1774
+ end
1775
+ endgenerate
1776
+
1777
+ // Optional output register
1778
+ generate
1779
+ if (A_DO_REG) begin
1780
+ always @(posedge fifo_rdclk) begin
1781
+ A_DO_reg <= A_DO_out;
1782
+ end
1783
+ assign A_DO = A_DO_reg;
1784
+ end
1785
+ else begin
1786
+ assign A_DO = A_DO_out;
1787
+ end
1788
+ if (B_DO_REG) begin
1789
+ always @(posedge fifo_rdclk) begin
1790
+ B_DO_reg <= B_DO_out;
1791
+ end
1792
+ assign B_DO = B_DO_reg;
1793
+ end
1794
+ else begin
1795
+ assign B_DO = B_DO_out;
1796
+ end
1797
+ endgenerate
1798
+ endmodule
1799
+
1415
1800
  // Models of the LUT2 tree primitives
1416
1801
  module CC_L2T4(
1417
1802
  output O,
@@ -62,6 +62,6 @@ module _80_gw1n_alu(A, B, CI, BI, X, Y, CO);
62
62
  .SUM(Y[i])
63
63
  );
64
64
  end endgenerate
65
- assign X = AA ^ BB;
65
+ assign X = AA ^ BB ^ {Y_WIDTH{BI}};
66
66
  endmodule
67
67