Commit Graph

143 Commits

Author SHA1 Message Date
YRabbit
2d45d57b32 gowin: Add PLL support for the GW1NR-9C chip
This chip is used in the Tangnano9k board.

  * all parameters of the rPLL primitive are supported;
  * all PLL outputs are treated as clock sources and optimized routing
    is applied to them;
  * primitive rPLL on different chips has a completely different
    structure: for example in GW1N-1 it takes two cells, and in GW1NR-9C
    as many as four, despite this unification was carried out and
    different chips are processed by the same functions, but this led to
    the fact that you can not use the PLL chip GW1N-1 with the old
    apicula bases - will issue a warning and refuse to encode primitive.
    In other cases compatibility is supported.
  * Cosmetic change: the usage report shows the rPLL names without any
    service bels.
  * I use ctx->idf() on occasion, it's not a total redesign.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2023-01-26 20:26:05 +10:00
YRabbit
cc45f5ec48 gowin: improve error message
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2023-01-19 07:12:39 +10:00
YRabbit
ba4d7b1e9a gowin: to use the FB network detection function
The chip used in tangnano4k does not have such pins, but we call the
function anyway in the expectation of other chips.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2023-01-19 06:31:55 +10:00
YRabbit
b22eebac30 gowin: add a PLL primitive for the GW1NS-4 series
* both instances of the new PLLVR type are supported;
  * primitive placement is optimized for the use of dedicated PLL clock
    pins;
  * all 4 outputs of each primitive can use the clock nets (only 5 lines
    in total at the same time so far).

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2023-01-18 19:18:02 +10:00
YRabbit
b8ab3116b2 gowin: improve clock wire routing
The dedicated router for clock wires now understands not only the IO
pins but also the rPLL outputs as clock sources.

This simple router sets an optimal route, so it is now the default
router. It can be disabled with the --disable-globals command line flag
if desired, but this is not recommended due to possible clock skew.

Still for GW1N-4C there is no good router for clock wires as there
external quartz resonator is connected via PLL.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-30 11:55:39 +10:00
YRabbit
8424dc79d2 gowin: correct the delay calculation
And do a full enumeration when searching for a delay because it is not
yet clear whether the orderliness of the vector is guaranteed.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-29 11:17:45 +10:00
YRabbit
d6cbe4b7f8 gowin: fix build for wasm
A large number of global variables are not suitable for WASM, so
completely disable the graphics part where the main array of them is
used.  For other architectures GUI is still possible.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-21 16:13:08 +10:00
YRabbit
bc3d9f3108 gowin: not crush on unknown clock tap's sources
As preparation for possible changes to the clock wiring system.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-14 15:35:55 +10:00
YRabbit
aa8359c73e gowin: BUGFIX: Correctly handle resets
When a single primitive occupies several cells, care must be taken when
manipulating the parameters of that primitive: when creating cells, each
cell must receive a copy of all the parameters and not modify them
unnecessarily.  That is, if possible, it is better to make all parameter
changes before dividing the primitive into cells.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-09 12:55:22 +10:00
myrtle
0eb53d59d8
Merge pull request #1059 from YosysHQ/gatecat/validity-errors
Add new option for verbose validity errors, use for ice40
2022-12-07 16:19:55 +01:00
gatecat
603b60da8d api: add explain_invalid option to isBelLocationValid
Signed-off-by: gatecat <gatecat@ds0.me>
2022-12-07 10:27:58 +01:00
myrtle
519011533a
Merge pull request #1058 from YosysHQ/gatecat/bounds-refactor
refactor: rename ArcBounds -> BoundingBox and use this in HeAP
2022-12-07 10:26:17 +01:00
gatecat
e260ac33ab refactor: ArcBounds -> BoundingBox
Signed-off-by: gatecat <gatecat@ds0.me>
2022-12-07 10:00:53 +01:00
YRabbit
150a482b77 gowin: change the way networks are handled
Until a comprehensive clock router is developed, the order in which
private cases are handled is important.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-06 23:07:01 +10:00
YRabbit
2e68962a02 gowin: add PLL pins processing
Uses the information of the special input pins for the PLL in the
current chip. If such pins are involved, no routing is performed and
information about the use of implicit wires is passed to the packer.

The RESET and RESET_P inputs are now also disabled if they are connected
to VSS/VCC.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-12-04 15:06:44 +10:00
YRabbit
ec53ae0c3b gowin: add information about pin configurations
Includes information on additional pin functions such as RPLL_C_IN, GCLKC_3, SCLK and others.
This allows a decision to be made about special network routing of such pins

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-25 20:49:26 +10:00
YRabbit
378ca60a2f gowin: mark the PLL ports that are not in use
Unused ports are deactivated by special fuse combinations, rather than
being left dangling in the air.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-20 22:04:09 +10:00
YRabbit
d4642d918c gowin: add support for a more common chip
The GW1N-1 and GW1NZ-1 have a similar PLL, but the board with the former
chip is already very hard to buy, so let's experiment with a more
affordable chip.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-12 10:12:43 +10:00
YRabbit
9013b2de50 gowin: use ctx->idf() a bit
Replacing snprintf() with ctx->idf() in PLL commit, but not yet a
complete overhaul.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-11 09:19:16 +10:00
YRabbit
a84ded4793 gowin: add initial PLL support
The rPLL primitive for the simplest chip (GW1N-1) in the family is
processed. All parameters of the primitive are passed on to gowin_pack,
and general-purpose wires are used for routing outputs of the primitive.

Compatible with older versions of apicula, but in this case will refuse
to place the new primitive.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-10 19:14:41 +10:00
gatecat
445d32497d run clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2022-10-17 12:35:02 +02:00
Lushay Labs
a7acda95f0
support windows line endings 2022-10-09 23:47:09 +03:00
YRabbit
e0539f0ed7 gowin: BUGFIX. Really memorize the chip
When it really needed to distinguish between the chips, this
unforgivable error was discovered :)

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-08-25 11:52:29 +10:00
gatecat
c60fb94b6c refactor: Use IdString::in instead of || chains
Signed-off-by: gatecat <gatecat@ds0.me>
2022-08-10 18:58:22 +01:00
gatecat
77c82b0fbf refactor: id(stringf(...)) to new idf(...) helper
Signed-off-by: gatecat <gatecat@ds0.me>
2022-08-10 10:57:46 +01:00
YRabbit
ce2335bc00 gowin: fix compilation
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-19 20:20:26 +10:00
YRabbit
6969782a4b gowin: Remove incomprehensible names of the muxes
There is no need to multiply item names, it is a rudiment of my very
first addition to nextpnr.

Fully compatible with older versions of Apicula.

Note: the cosmetic changes in lines with RAM are not my initiative, but
the result of applying clang-format.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-19 18:51:25 +10:00
YRabbit
1ebfe67daf gowin: Remove unnecessary functions
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-05 20:02:12 +10:00
YRabbit
3364a3b674 Merge branch 'master' into clock-wip 2022-07-05 19:43:24 +10:00
YRabbit
5d915a550b gowin: fix compilation
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-04 11:23:21 +10:00
YRabbit
3172a38dae gowin: Let the placer know about global networks
Refactor in order to detect networks that will be routed in a special
mode earlier. This makes it possible to mark the source of such networks
as a global buffer, thereby removing their influence on element
placement.

In addition, timing classes are set for some cells.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-04 10:32:39 +10:00
Pepijn de Vos
6f56ad298c use DFF RAM mode 2022-07-02 20:44:59 +02:00
Pepijn de Vos
0641ff47d9 Merge branch 'master' into shadowram 2022-07-02 13:29:44 +02:00
YRabbit
63f2acd42a gowin: process the CLK ports of the ODDR[C] primitives
Also removed the useless references.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-24 08:20:06 +10:00
YRabbit
590b9050ff gowin: add a separate router for the clocks
A simple router that takes advantage of the fact that in each cell with
DFFs their CLK inputs can directly connect to the global clock network.

Networks with a large number of such sinks are sought and then each
network is assigned to the available independent global clock networks.

There are limited possibilities for routing mixed networks, that is,
when the sinks are not only CLKs: in this case an attempt is made to use
wires such as SN10/20 and EW10/20, that is, one short transition can be
added between the global clock network and the sink.

* At this time, networks with a source other than the I/O pin are not
  supported. This is typical for Tangnano4k and runber boards.

* Router is disabled by default, you need to specify option
  --enable-globals to activate

* No new chip bases are required. This may change in the distant future.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-23 11:42:58 +10:00
Pepijn de Vos
b7992ec772 hook up CE maybe 2022-06-16 11:38:23 +02:00
YRabbit
bd0af4052c gowin: Use local aliases
In the Gowin chips, the tiles are connected to each other by a one-hop
wire, among others. There are 4 one-hop wires, of which 2 are shared
between north/south and east/west, have three names: e.g. SN10 and N110
and S110.

But only one of them, the first, occurs as a sink for PIP, that is, you
can not get a route that would pass through the S110 for example.

This commit corrects the names to SN?0 and EW?0 at the wire creation
stage to avoid dead wires.

In addition, the SN?0 and EW?0 are among the few sinks for global clock
wires and now there is the possibility of a more optimal clock routing.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-09 08:20:29 +10:00
Pepijn de Vos
de1bee9352 lutram actually PnRs 2022-06-06 14:35:33 +02:00
Pepijn de Vos
490dddf636 WIP shadowram 2022-06-05 16:59:06 +02:00
YRabbit
db696af2fe gowin: Add support for long wires
Gowin chips have a highly sophisticated system of long wires that are
wired to each cell and allow the clock or logic to spread quickly.

This commit implements some of the capabilities of the long wire system
for quadrants, leaving out the fine-tuning of them for each column.

To make use of the long wire system, the specified wire is cut at the
driver and a special cell is placed between the driver and the rest of
the wire.

* VCC and GND can not use long wires because they are in every cell and
  there is no point in using a net
* Long wire numbers can be specified manually or assigned automatically.
* The route from the driver to the port of the new cell can be quite
  long, this will have to be solved somehow.
* It might make sense to add a mechanism for automatically finding
  candidates for long wires.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-05-27 22:44:21 +10:00
YRabbit
15413de359 gowin: Add initial syntax support for long wires
Only the recognition of the directive in the .CST file and elementary
checks are added, but not the long-wire mechanism itself.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-05-02 20:40:33 +10:00
YRabbit
85e8570a73 gowin: handle the GW1N-9 feature.
This chip has a different default state for one type of I/O buffer ---
you have to explicitly switch it to the normal state by feeding VCC/VSS
to certain inputs.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-04-03 10:05:27 +10:00
Tim Pambor
601b32948b gowin: Fix z-index of oscillator 2022-03-30 17:35:54 +02:00
Tim Pambor
12b38bab6d gowin: Add bels for oscillator 2022-03-27 22:15:12 +02:00
YRabbit
be8d3fd74d gowin: Consider the peculiarity of GW1BR-9C
The GW1NR-9C chip ODDR implementation differs from all other supported
chips by two suspicious inputs.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-26 20:56:30 +10:00
YRabbit
69b4461f55
gowin: Name the constants (#958)
Place arbitrary constants side by side to avoid conflicts.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-21 20:15:29 +00:00
Pepijn de Vos
bb923c7732
Gowin: use global VCC and VSS nets (#956)
* use global VCC and VSS nets

* derp

* remove init parameter
2022-03-19 18:44:08 +00:00
YRabbit
c898587b87 gowin: don't crash if no arguments are set
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-16 15:47:13 +10:00
gatecat
2df9d3537b
Merge pull request #943 from yrabbit/locale
gowin: support for locales other than en_US and C
2022-03-15 20:44:03 +00:00
YRabbit
53ddbbaa85 Set the locale as early as possible
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-16 05:39:55 +10:00