Commit Graph

4973 Commits

Author SHA1 Message Date
Lofty 33a91cb196 improved estimateDelay formula 2025-09-10 13:58:20 +01:00
Miodrag Milanovic b8d2372019 gatemate: BUFG must be optional 2025-09-10 14:42:47 +02:00
Miodrag Milanović 8ac7ed161a
gatemate: code cleanup and netlist fix (#1554) 2025-09-10 14:04:42 +02:00
myrtle 9715a1d565
heap: Allow chains to ripup other chains (opt-in only) (#1552)
Signed-off-by: gatecat <gatecat@ds0.me>
2025-09-05 09:02:19 +02:00
Miodrag Milanović 141abe60a6
gatemate: cleanup BRAM handling (#1551) 2025-09-05 08:37:29 +02:00
Miodrag Milanović 21bfda4165
gatemate: fix fourgroup for multi die (#1550) 2025-09-03 12:20:11 +02:00
Lofty f238e2c4a5
okami: remove (#1549) 2025-09-02 19:42:07 +02:00
Miodrag Milanović 3eb682bcbb
gatemate: use CPE bridge (#1538)
* Add bridge support

* Use bridge only if CPE is unused

* do not use CPE_MULT for MUX routing

* Fixed and documented

* delay for CPE_BRIDGE

* Convert bridge pips into bels

Co-authored-by: Miodrag Milanovic <mmicko@gmail.com>

* recursively reassign bridges

* reconnect cell ports to new nets

* handle inversion bits

* sort data in output for easier compare

* one to be removed after testing

* debug message

* Remove need for notifyPipChange

* use same logic for detecting bridge pips

* make sure that the pip used is the one assigned

* one wire may feed multiple ports

* remove #if

* clean up wire binding

* add debugging

* fix

* clangformat

* put back to error

* use tile instead of getting name out of bel/pip

* bump chipdb

* adressing review comments

* Addressed last one

---------

Co-authored-by: Lofty <dan.ravensloft@gmail.com>
2025-09-02 18:00:01 +02:00
Miodrag Milanović 4e4f4ab113
gatemate: update bounding box (#1548) 2025-09-02 14:04:28 +02:00
Miodrag Milanović 0399b8865e
gatemate: Enable placing RAM halfs (#1544)
* gatemate: Split BRAMs into halfs

* Cleanups

* move code arround

* optmize remapping halfs

* Name RAM cells

* fix cluster setting for cascade mode

* attach ECC pins

* rewire global clocks

* bump chip database version

* Fix KEEPER setting

* Fix conflict check

* cleanup
2025-09-02 08:03:22 +02:00
YRabbit a18bd2e055
Gowin. BUGFIX. Add data about gate wires. (#1547)
Very rarely (about once a year), the dedicated clock router would
malfunction, issuing an incorrect route.

The reason turned out to be the so-called gate wires to the global clock
wire system from the logic. Among the PIPs for which these wires are
sinks, there are PIPs where the sources are also clock wires.

This leads to the possibility of feeding the clock signal back into the
gate and again into the global clock MUX.

If handled carelessly, this can lead to a complete loop.

But the loop option itself is particularly useful in the case of DCS
(dynamic clock selection) - the fact is that because these primitives
have four clock inputs and each of them could theoretically address all
56 clock sources, but in practice there are not enough wires and the DCS
inputs cannot serve as sinks for all clock sources.

The simplest solution (and the one that currently works) is to use the
gate to re-enter the clock system, but this time changing the clock
source.

This commit explicitly marks wires as gates and removes the possibility
of looping (however unlikely it may be) where a loop is not needed.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-02 07:51:08 +02:00
YRabbit 7d2caf6939 Gowin. Fix style.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-01 16:14:49 +01:00
YRabbit 75aa8d16ac Gowin. Implement on-chip oscillator.
A programmable on-chip crystal oscillator has been implemented for the
GW5A series.

A critical innovation in this series was the change in the nature of the
OSC output pin—it now belongs to the clock wires, and therefore the
routes must be made with a special global router, as there is no
possibility of using routing through general-purpose PIPs.

At the same time, we are transferring the outputs of all previous
generations of OSC to potential clock wires. At the moment, this will
not affect the way they are routed - they will still end up as segments
as before, but in the future we may optimize the mechanism.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-01 16:14:49 +01:00
YRabbit bc086c012f
Gowin. Optimize ALU wiring (#1543)
* Gowin. Optimize ALU wiring

Interestingly, although VCC and GND sources are present in each cell,
they cannot be connected directly to all LUT inputs. Instead, additional
PIPs are used.

A very simple ALU optimization: once we detect that one of the inputs is
a constant, we modify the main LUT that describes the ALU function so
that this primitive input is ignored, and then disconnect it from the
network, freeing up the PIP.
For example (unrealistic, since a real ALU LUT has a larger size and
service bits in the middle, etc.), the addition function of A and B when
A = 1 is converted from the general case (A isn't a constant and B isn't a
constant) to a special case:
0110 -> 0011

The renaming of ALU ports for ADD and SUB modes has also been
removed—this has already been done in the chip database as a fixed
change to the ALU LUT.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>

* Gowin. Fix the style.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>

---------

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-29 16:58:26 +02:00
Miodrag Milanovic e1ba78094f gatemate: clean data bitmask 2025-08-27 12:28:58 +02:00
Miodrag Milanovic 8ab9301dc4 clangformat 2025-08-27 10:37:39 +02:00
Miodrag Milanovic 2b203d21ae gatemate: add missing RAM port mapping 2025-08-27 10:37:10 +02:00
YRabbit 52254dca35
Gowin. Add ROM16 primitive. (#1542)
The LUTRAM mode is added to all supported chips at once.

This is essentially an alias for LUT4, so the packaging is also moved
before searching for LUT-DFF pairs for possible optimization.

In addition to being the only LUTRAM mode in the GW5A series, the
addition of ROM16 eliminates the need to manually rename the primitive
and its pins when working with files generated by Gowin IDE - a similar
situation occurred with INV, which is essentially LUT1.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-27 07:21:38 +02:00
YRabbit d966fc5dcb
Gowin. Implement ALU for the GW5A series. (#1541)
The ALUs in the GW5A series have undergone changes compared to previous
chips.

The most significant change is the appearance of an input MUX for
carry — it is now possible to switch between VCC, GND, and COUT of the
previous ALU, as well as generate carry in logic.

The granularity of resource allocation for ALUs has also changed — it is
now possible to use each half of a slice independently for ALUs.

Not all new features are reflected in this commit:

  - since there is one CIN MUX for every six ALUs and it only works for
    ALUs with index 0, the new granularity is not very useful: the head of
    the chain can only be placed in the zero ALU. It is possible to gain one
    LUT by allocating ALUs in odd numbers, but we will leave that for the
    future.

  - using CIN MUX to generate carry in logic is interesting, but we have
    not yet been able to get the vendor IDE to generate such a
    configuration to figure out which wires are used, so for now we are
    leaving the old behavior in logic with the allocation of a specialized
    head ALU.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-26 16:17:55 +02:00
Lofty 0a7cbe1cd7
router2: iteratively reserve arc driver wires, too (#1539) 2025-08-26 16:17:11 +02:00
Miodrag Milanovic ca4f727ffc gatemate: fix CI/CO RAM connections 2025-08-25 12:24:46 +02:00
Miodrag Milanovic 84234e7d79 gatemate: delay, assign proper RAM clock 2025-08-25 10:55:19 +02:00
Miodrag Milanovic d796cc720b clangformat 2025-08-22 11:08:39 +02:00
Miodrag Milanović 6a598b945e
gatemate: add iopath delays (#1537)
* Timing

* clangformat

* Import some new data

* Import all timing data

* Add constants for needed timings

* Add separate file for delay handling

* wip

* Added helpers

* wip

* proper place for assignArchInfo

* wip

* wip

* Fixes for IO

* Add IOSEL delays

* Fix logic loops

* help figure out some ram paths

* return true only if exists

* cover all primitives

* Disable not used paths

* clockToQ

* Added some RAM timings

* Add more IOPATHs

* cleanup

* cleanup

* Map few more timings

* remove short name options

* support strings as options

* no need for return
2025-08-22 11:07:34 +02:00
Miodrag Milanović e598b2f4d9
gatemate: special case RAMIO when needed (#1536) 2025-08-21 15:11:08 +02:00
Miodrag Milanović 82f8ff7cad
himbaechel: Extend API to enable cell delay override (#1535) 2025-08-20 06:32:18 +02:00
YRabbit 322ad920b3
Gowin. Enable GW5A series. (#1534)
With the release of Apicula 0.22, the GW5A series gained support for
simple IO, LUTs (including Widw LUTs), and DFFs (including flip-flops 6
and 7 specific to the GW5A series), so we can include the GW5A-25A among
Gowin devices.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-15 07:12:09 +02:00
YRabbit 178021959c Gowin. Change the way DFF 6&7 presence is checked.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-14 12:33:48 +01:00
YRabbit 2d0ad9f9b1 Gowin. Use two additional DFFs.
The GW-5A series has 8 flip-flops in a cell instead of 6. These
additional flip-flops can be used if the control network matches that
for the 4th and 5th DFFs in this cell.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-14 12:33:48 +01:00
Miodrag Milanović 95ab16f380
gatemate: add IOSEL as separate primitive (#1533) 2025-08-14 12:20:24 +02:00
Will MacCormack b0626280e9 Change Hash Embed check to check for erroneous signed #embed 2025-08-10 21:39:16 +01:00
Lofty 5355222e09 Revert "gatemate: don't place cells all at once (#1528)"
This reverts commit 2d393c2487.
2025-08-09 04:35:20 +01:00
Lofty 2d393c2487
gatemate: don't place cells all at once (#1528) 2025-08-08 18:19:42 +02:00
Lofty 0ad43e6ec7
gatemate: remove placement density restriction (#1527) 2025-08-08 17:02:56 +02:00
YRabbit 0be6173064 Gowin. Add pin configurations bel/cell.
Prior to the 5A series, pin functions (GPIO/SSPI/JTAG/DONE/etc) were
switched using fuses. This was done during the binary image formation
stage for loading into the FPGA using the command line keys of the
gowin_pack program.

The 5A series features certain ports that connect to VCC or GND
depending on whether the pin is used as SSPI or GPIO, for example. This
mechanism exists in parallel with fuses, but it is not described
anywhere, nor is there a corresponding primitive.

To generate working images, we have no choice but to simulate this thing
at the nextpnr stage, since VCC/GND routing is required.

For now, two flags are added, responsible for the SSPI and I2C pin
functions.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-08 13:27:37 +01:00
YRabbit 8ce9918405 Gowin. Remove search for old Apicula.
This item is likely no longer necessary, as this executable file has
been unavailable since May, with the complete transition to Himbaechel.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-08-06 00:32:41 +01:00
Lofty 8938c73fc9
Merge pull request #1524 from YosysHQ/lofty/gatemate-mult-router
gatemate: multiplier router
2025-08-05 11:20:25 +01:00
Miodrag Milanovic 6b11a82d04 cleanup 2025-08-04 14:28:43 +02:00
Miodrag Milanovic f0e03ed6e7 cleanup 2025-08-04 14:23:18 +02:00
Miodrag Milanovic 89e7e059d8 cleanup 2025-08-04 13:55:19 +02:00
Miodrag Milanovic eb77362b97 Added logs under debug, and removed include for idstring.h 2025-08-04 13:50:19 +02:00
Miodrag Milanovic 88f52bcaba Fix multipliers on hardware 2025-08-04 13:26:26 +02:00
Lofty 60f3c25cb0 refactor inversion checker 2025-08-02 15:23:56 +01:00
Lofty fe7546fda5 Multiplier routing needs priority over clocks 2025-08-02 14:00:25 +01:00
Miodrag Milanovic 0810a9a243 More multiplier fixes 2025-08-02 13:04:13 +02:00
Miodrag Milanovic 6a3c4a2dca Enable pack_mult 2025-08-01 17:47:07 +02:00
Miodrag Milanovic 1748f38aad Add MULT_INVERT property 2025-08-01 17:46:48 +02:00
Lofty d26fc19724 clangformat 2025-08-01 16:46:22 +01:00
Miodrag Milanovic 49001df290 Fix when width is 1 2025-08-01 14:46:54 +02:00
Miodrag Milanovic da5d42dc9d Add missing connection 2025-08-01 12:25:22 +02:00