Commit Graph

309 Commits

Author SHA1 Message Date
gatecat 1f4d3fdc91 Add a workaround for DCI for now
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-21 20:17:34 +01:00
gatecat fc1f50937c xilinx: Enable MMCM related pips
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-21 20:17:34 +01:00
gatecat 05e6915369 xilinx: Fix RAM256X1S packing
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-21 20:17:34 +01:00
gatecat 0cd6e72d5f xilinx: Add MMCM support
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-21 20:17:34 +01:00
gatecat c0ff514582 xilinx: Work around missing kintex7 timing for now
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-21 17:52:08 +01:00
YRabbit d43c09d070
Gowin. Divide packer. (#1645)
Split the packer into several files.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-02-21 08:11:39 +01:00
YRabbit 5bbaac8572
Gowin. Implement GW5A DSP. (#1641)
* Gowin. DSP. Implement MULT12x12.

The 5A series DSP differs from previous ones. Many things have been
greatly simplified: there are only two control signals of one type per
cell (2 CLK, 2 CE and 2 RESET), and these signals are now explicitly
specified in the DSP attributes, which makes the automatic assignment
mechanism unnecessary for them.

The DSP occupies 3 cells instead of nine due to the exclusion of 4
low-bit multipliers - now there are only two 12x12. There will naturally
be clusters, but they will be simpler and consist of other primitives.

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

* Gowin. Implement MULTADDALU12X12.

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

---------

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-02-20 07:48:22 +01:00
myrtle 49ba0b277f
Support use of router2 for gowin (#1636)
Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-17 09:26:25 +01:00
Pepijn de Vos 06ae973aa8
Msgspec serialization (#1640)
* gowin: Update arch gen to use msgspec chipdb format

Apycula now uses msgspec MessagePack serialization instead of pickle
for the chipdb files. This change:

- Replaces pickle with msgspec via load_chipdb()
- Changes file extension from .pickle to .msgpack.gz
- Updates grid access patterns for new Device structure where
  db.grid[y][x] returns ttyp (int) directly, use db[y, x] for Tile

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update chipdb extension to .msgpack.xz

Apicula switched from gzip to lzma compression for chipdb files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-15 08:47:16 +01:00
myrtle 2a8bab976d
gowin: Perfomance improvements round 1 (#1632)
* gowin: Configure HeAP

Signed-off-by: gatecat <gatecat@ds0.me>

* gowin: Use fast constant value routing

Signed-off-by: gatecat <gatecat@ds0.me>

---------

Signed-off-by: gatecat <gatecat@ds0.me>
2026-02-10 20:54:09 +01:00
YRabbit 3c558d6e3d
Gowin. DSP. Allow combinatorial modes. (#1634)
Do not assume that RESET, CE, and CLK pins are always present.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-02-06 07:01:09 +01:00
YRabbit 826a534195
Gowin. BUGFIX. DSP. (#1633)
Only one bit per macro is responsible for the bit width of operands. We
add operand width tracking and do not allow different operands to be
combined in a single macro.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-02-05 09:39:53 +01:00
YRabbit b4da86edce
Gowin. Add GW5AST-138C chip. (#1631)
* Gowin. Add GW5AST-138C chip.

The ability to perform P&R for the largest GW5A series chip currently
available has been added, which has its own characteristics:

  - the need to invert pin function configuration signals - these
    signals are not part of the design, but are nextpnr command line
    keys  for specifying the activation of alternative pin functions such as
    I2C;

  - some clock PIPs are encoded not by fuses, but by applying VCC/GND to
    special inputs. This is also not part of the design and is not a
    dynamic clock selection primitive - it is simply an addition to the
    fuses.

  - added check for DFF and SSRAM placement in upper slots - prior to
    this chip, SSRAM was not supported and there was no need for this
    check.

  - since the chip is divided into two parts in terms of the global
    clock network, a flag is introduced to indicate which part the wire
    belongs to. This is only requested for clock wires.

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

* Gowin. Fix style.

Use C++ type cast.

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

---------

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-01-31 13:01:22 +01:00
Miodrag Milanovic 1c099cfca1 clangformat 2026-01-23 09:35:51 +01:00
Patrick Urban 25c81e3a3e
gatemate: fix block RAM ECC status signal wiring and delay annotation (#1629)
* gatemate: fix ECC CPE connection

* gatemate: fix typos

* gatemate: add ECC signals to `ram_signal_clk` dictionary

* gatemate: allow switching between NOECC and ECC block RAM delays
2026-01-23 09:34:57 +01:00
YRabbit 15d94b40a5
Gowin. Ignore empty lines. (#1626)
Including those containing nothing but spaces and tabs.

Fixes https://github.com/YosysHQ/apicula/issues/432

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-01-20 08:11:48 +01:00
YRabbit 1ce187ab5a
Gowin. BUGFIX. BSRAM SP separation. (#1622)
* Gowin. BUGFIX. BSRAM SP separation.

The new SP cell must inherit the byte size - 8 or 9 bits.

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

* Gowin. Byte Enables processing in SP.

Single Port with a data width of 32/36 is internally configured as Dual
Port with 16/18. Even and odd words are processed separately by ports A
and B.

With the advent of byte enable support, it became necessary to switch
these signals differently.

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

---------

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2026-01-05 11:27:43 +01:00
Miodrag Milanović 7bd1336f88
gatemate: RAMIO packing optimization (#1602)
* gatemate: RAMIO packing optimization

* Disable packing DFF in RAMIO
2025-12-23 09:03:06 +01:00
Miodrag Milanović c30f810ee0
gatemate: Add LUT permutation support (#1619)
Adds LUT permutation support
2025-12-22 15:10:53 +01:00
Miodrag Milanović 210e6c8158
gatemate: add missing MULT timing path (#1618) 2025-12-17 11:53:10 +01:00
Miodrag Milanović f5374d6de4
himbaechel: fix parsing vopt memory issue (#1614) 2025-12-12 14:11:34 +01:00
Lofty 12342a60e6
gatemate: fix output register packing (#1608) 2025-12-12 08:52:26 +01:00
Lofty cfa5f77dd9
gatemate: pack multiplier output registers (#1603)
* small cleanup

* gatemate: pack output flops for multipliers

* remove possibly-inaccurate comments
2025-11-24 15:35:18 +00:00
YRabbit 900573c778
Gowin. Implemenet special ADC IO. (#1598)
The TLVDS_IBUF_ADC IO primitives have been implemented, which provide a
signal for ADC bus 2. These differential IO primitives also have an
additional input that allows them to be disabled, thereby providing
dynamic switching of the signal source for the ADC.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-11-18 12:44:15 +01:00
Miodrag Milanovic 69facd7c9a Bump gatemate chip database 2025-11-10 12:05:33 +01:00
YRabbit d8117e3cad
Gowin. Implement ADC. (#1597)
ADC support for GW5A-25 chips has been added.

The inputs of this primitive are fixed and do not require routing,
although they can be switched dynamically.

The .CST file also specifies the pins used as signal sources for the
bus0 and bus1 ADC buses.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-11-06 09:17:05 +01:00
Patrick Urban 30669eca60
gatemate: fix SERDES CDR parameters (#1596) 2025-10-28 09:49:55 +01:00
tgingold 35629d0a43
gatemate: handle default parameters for IO (#1595)
* gatemate: handle default parameters for IO

This is probably a VHDL specific issue.  In VHDL, there is no
black-box. Primitive instantiations are done using VHDL component
instantiations and the component must have been declared with all its
ports and parameters (generic).  Currently the components are
translated from cells_sim.v and cells_bb.v

If a user doesn't override a parameter, the default value is used
instead.  As a consequence, nextpnr can have 'UNDEFINED' for DRIVER
or SLEW parameters of CC_IOBUF.  I think this is a main difference
with verilog, where unspecified parameters do not appear.

With this change, the UNPLACED value of PIN_NAME and UNDEFINED value
of DRIVE are simply ignored.

* gatemate/pack_io.cc: also handle UNDEFINED for id_SLEW
2025-10-28 08:16:02 +01:00
YRabbit c133d00e2e
Gowin. Take the arch arguments directly. (#1592)
Since ctx->getArchArgs() no longer returns architecture-specific
arguments, we read the args field directly.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-10-23 07:58:01 +02:00
myrtle c7cfb0aa4b
Remove use of boost system and filesystem (#1591)
Signed-off-by: gatecat <gatecat@ds0.me>
2025-10-22 15:01:21 +02:00
Miodrag Milanović 9ccd132437
himbaechel: add uarch specific options parsing (#1582)
* himbaechel: add uarch specific options parsing

* fix tests

* add reference to additional help

* review comments addressed

* cleanup and unify other uarch

* Adressed PR comments
2025-10-21 14:41:53 +02:00
Miodrag Milanović c6f408dfa7
gatemate: additional region handling (#1583)
* gatemate: Use GATEMATE_DIE attribute to select placement die

* add DIE parameter in CCF

* add penalty delay when crossing between dies

* Add predictDelay
2025-10-21 13:47:07 +02:00
Miodrag Milanović 924f3a50ab
gatemate: properly name timing and operational mode (#1587) 2025-10-21 13:46:34 +02:00
YRabbit dfef396dec
Gowin. Delete unused OBUFs. (#1581)
Paired with
6535995005

now that we may receive unattached OBUFs, we ignore them.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-10-17 14:16:52 +02:00
Miodrag Milanovic 9d7e1d0ad1 gatemate: bump chipdb to 1.9 2025-10-17 11:57:53 +02:00
Miodrag Milanović f19a67122f
gatemate: document clock distribution strategies (#1580)
* gatemate: document clock distribution strategies

* gatemate: rename option to strategy
2025-10-16 10:54:55 +02:00
Miodrag Milanović 36045543c7
gatemate: support multiple clock distribution strategies (#1574)
* gatemate: support multiple clock distribution strategies

* error out on non supported cases

* Implement full use strategy

* Address review comments
2025-10-15 15:33:21 +02:00
YRabbit c7836625b9
Gowin. Add BSRAM SDP fix. (#1575)
In the GW5A series, the primitive SemiDual Port BSRAM cannot function
when the width of any of the ports is 32/36 bits - it is necessary to
divide one block into two identical ones, each of which will be
responsible for 16 bits.

Here, we perform such a division and, in addition, ensure that the new
cells resulting from the division undergo the same packing procedure as
the original ones.

Naturally, with some reservations (the AUX attribute is responsible for
this) - in the case of SP, when service elements are added, it makes
sense to do this immediately for 32-bit SP and only then divide.

Also, SDPs are currently being corrected for cases where both ports are
‘problematic’, but it may happen that one port is 32 and the other is,
say, 1/2/4/8/16. This has been left for the future.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-10-13 11:07:39 +02:00
Gwenhael Goavec-Merou 4b00f58af5
himbaechel/uarch/gowin/cst.cc: added support for IO_LOC with _p/_n separated by a comma (#1571) 2025-10-08 14:26:50 +02:00
YRabbit e9bac6961a
Gowin. GW5A series BSRAM fix. (#1564)
In the new series of chips, the SemiDual Port primitive has one RESET
pin instead of two in previous versions - RESETA and RESETB.

Physically, the two pins are still there and both must be connected,
with RESETA being constant.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-10-04 15:03:33 +02:00
YRabbit 57f70aeeb8
Gowin. Remove the special status of corner tiles. (#1565)
Over time, it became clear that the special status of corner tiles is
handled in other parts of the toolchain, and in the GW5A chip series, it
began to interfere—in this series, IO can be located in the corners.

So we move the only function (creating VCC and GND) to the extra
function itself, and at the same time create a mechanism for explicitly
specifying the location of these sources in Apicula when necessary.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-10-04 15:02:53 +02:00
Miodrag Milanović ad76625d4d
gatemate: respect keep attribute and prevent crash with BEL set (#1566) 2025-10-02 11:27:44 +02:00
Miodrag Milanović abb52f81c2
gatemate: cleanup of PLL and BUFG (#1562)
* Check SER_CLK more

* Use connectPorts

* move rewire code

* Move data structures

* move placement decision for later

* cleanups

* find working layout

* clangformat

* Inverted input on ODDR

* Fix some tests

* Copy clocks for multi die

* cleanup

* reporting

* bugfix

* handle PLL special inputs

* Fix user globals

* Proper DDR per bank and cleanup

* Add extra data for die regions and create them

* Better forced_die implementation

* Copy region to newly generated cells, and update when constrained

* Update PLL error messages

* Add TODO comment
2025-09-30 13:00:02 +02:00
Miodrag Milanović 8381827fa5
gatemate: Include and use connection timing data (#1559)
* convert nodes to pips

* add plane info for node pips

* a few multiplier router fixes

* do not need node delay

* add pip delays

* cleanup

* tried fixing clock router

* add PLL delays

* fix clock routing

* Do not use actual pip delay, determine best by number of passed pips

* optimize

* proper parameter check

* more multiplier fixes

* another mult fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* another multiplier fix

* log number of clock net users

* Revert "Do not use actual pip delay, determine best by number of passed pips"

This reverts commit c66e422dd0.

We want to guarantee minimum clock skew, so we need pip delay.

* route clocks from source to sink

* add time spent to route_clock

* weakly-bind non-global clocks

* clangformat

* remove dead code

* Require version 1.8

* change to assert

* add revisits in clock router

---------

Co-authored-by: Lofty <dan.ravensloft@gmail.com>
2025-09-30 09:13:29 +02:00
YRabbit 22041ed5df
Gowin. GW5A chips. Implement the DCS primitive. (#1558)
The GW5A series is interesting—in this particular primitive, the inputs
have been renamed from CLKx to CLKINx. Everything else remains the same,
including functionality.

As an output, we will store in the chip database which prefix the DCS
inputs have.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-23 12:42:33 +02:00
YRabbit 1742d09edb
Gowin. GW5A series PLLs. (#1557)
PLLA-type PLLs are implemented, which are used in GW5A-25A chips.

These are six powerful PLLs, each of which can generate seven
independent frequencies.

Since these devices have an unusual configuration—their fuse bits are
located outside the main grid and therefore their Bels do not have
specific “correct” coordinates—the extra bel functions mechanism is used
to describe them. But all the complexity falls on the apicula part.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-20 07:51:01 +02:00
YRabbit 4ab735c690
Gowin. Optimize ALU. (#1556)
By replacing the operation of adding the input to itself with a
specially formed LUT, we free up two PIPs.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2025-09-17 07:50:41 +02:00
Patrick Urban 00cf81e463
gatemate: fix static and handle dynamic FIFO almost full/empty offsets (#1555)
* gatemate/pack_bram: fix CC_FIFO_40K almost full/empty parameters

* gatemate/pack_bram: fifo read/write pointers are 16 bit wide

* gatemate/pack_bram: handle dynamic almost full/empty offsets
2025-09-12 15:02:28 +02: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