Commit graph

757 commits

Author SHA1 Message Date
whitequark 3a1dae591b back.rtlil: it is not necessary to match binop operand width. 2019-10-02 03:38:58 +00:00
Jean-François Nguyen 905920aa76 rpc: add public Records as module ports. 2019-09-30 18:28:21 +00:00
whitequark 52f36025a9 rpc: add support for Yosys RPC protocol. 2019-09-30 17:38:54 +00:00
whitequark 1621ceb65a hdl.ast: actually implement the // operator. 2019-09-28 19:33:24 +00:00
whitequark 450d7efdf2 hdl.dsl: add a diagnostic for m.d.submodules += .... 2019-09-28 17:50:24 +00:00
whitequark a02e3750bf hdl.mem: remove WritePort(priority=) argument.
The write port priority in Yosys is derived directly from the order
in which the ports are declared in the Verilog frontend. It is being
removed for several reasons:
  1. It is not clear if it works correctly for all cases (FFRAM,
     LUTRAM, BRAM).
  2. Although it is roundtripped via Verilog with correct simulation
     semantics, the resulting code has a high chance of being
     interpreted incorrectly by Xilinx tools.
  3. It cannot be roundtripped via FIRRTL, which is an alternative
     backend that is an interesting future option. (FIRRTL leaves
     write collision completely undefined.)
  3. It is a niche feature that, if it is needed, can be completely
     replaced using an explicit comparator, priority encoder, and
     write enable gating circuit. (This is what Xilinx recommends
     for handling this case.)

In the future we should extend nMigen's formal verification to assert
that a write collision does not happen.
2019-09-28 01:29:56 +00:00
whitequark e3a1d05f23 back.rtlil: fix handling of certain nested arrays.
This triggers on code like:

c1 = Signal()
c2 = Signal()
c3 = Signal()
v1 = Array([Const(1, 8), Const(2, 8)])[c1]
v2 = Array([Const(3, 8), Const(4, 8)])[c2]
v3 = Array([v1, v2])[c3]

Fixes #226.
2019-09-24 18:32:26 +00:00
whitequark 53bb4300a3 build.plat: strip internal attributes from Verilog output.
Although useful for debugging, most external tools often complain
about such attributes (with notable exception of Vivado). As such,
it is better to emit Verilog with these attributes into a separate
file such as `design.debug.v` and only emit the attributes that were
explicitly placed by the user to `design.v`.

This still leaves the (*init*) attribute. See #220 for details.
2019-09-24 14:56:00 +00:00
whitequark f87c00e6c3 build.plat,lib.cdc,vendor: unify platform related diagnostics. NFC. 2019-09-24 14:14:45 +00:00
whitequark 0858b8bf6c lib.cdc: specify maximum input delay in seconds.
Since we use hertz elsewhere, this provides for easy conversions.

Also, cast the delay to string before applying it in xilinx_7series,
to avoid stripping the fractional digits.

Closes #234.
2019-09-24 12:30:10 +00:00
whitequark b43d2d36e8 vendor.xilinx_spartan_3_6: explain why ASYNC_REG is used. NFC. 2019-09-24 12:22:29 +00:00
Kate Temkin d14366450b vendor.lattice_ecp5: correct a typo in tristate buffer generation 2019-09-24 11:53:38 +00:00
Darrell Harmon f3a8880cb8 vendor.xilinx_7series: apply false path / max delay constraints. 2019-09-24 00:47:54 +00:00
whitequark da53048ad4 vendor.xilinx_7series: simplify. NFC. 2019-09-23 20:27:42 +00:00
whitequark 6d8590a391 vendor.xilinx_7series: override reset synchronizer. 2019-09-23 20:15:29 +00:00
whitequark 22da78ca28 lib.cdc: add diagnostic checks for synchronization stage count. 2019-09-23 19:38:21 +00:00
whitequark 52e761dc33 lib.cdc: expand ResetSynchronizer documentation.
Loosely based on work by @Wren6991.
2019-09-23 19:31:23 +00:00
whitequark 86f0f12b58 lib.cdc: avoid modifying synchronizers in their elaborate() method. 2019-09-23 16:42:44 +00:00
Darrell Harmon 51f03bb509 vendor.xilinx_spartan_3_6: override reset synchronizer. 2019-09-23 16:28:15 +00:00
whitequark 8deb13cea3 lib.cdc: MultiReg→FFSynchronizer.
Fixes #229.
2019-09-23 14:18:45 +00:00
whitequark b227352258 hdl.ast: cast Mux() selector to bool if it is not a 1-bit value.
Fixes #232.
2019-09-23 13:39:31 +00:00
whitequark 7777b7b98c back.rtlil: give predictable names to anonymous subfragments.
This is required for applying constraints to clocks in anonymous
subfragments in build.plat.
2019-09-23 12:48:02 +00:00
whitequark fd625619f1 lib.fifo: handle depth=0, elaborating to a dummy FIFO with no logic. 2019-09-23 12:27:59 +00:00
whitequark bc53bbf564 hdl.mem,lib.fifo: use keyword-only arguments for memory geometry.
Fixes #230.
2019-09-23 12:15:06 +00:00
whitequark 1aeb11d7e3 hdl.mem: simplify. NFC. 2019-09-23 11:16:29 +00:00
whitequark 649444449d hdl.ast: make Signal(name=) a keyword-only argument.
Almost no code would specify Signal(_, name) as a positional argument
on purpose, but forgetting parens and accidentally placing signedness
into the name position is so common that we had a test for it.
2019-09-23 11:08:43 +00:00
whitequark 2da0133d52 lib.fifo: change FIFOInterface() diagnostics to follow Memory(). 2019-09-23 11:03:50 +00:00
whitequark ca6b1f2f1c lib.fifo: round up AsyncFIFO{,Buffered} depth to lowest valid value.
Unless exact_depth=True is specified.

The logic introduced in this commit is idempotent: that is, if one
uses the depth of one AsyncFIFOBuffered in the constructor of another
AsyncFIFOBuffered, they will end up with the same depth. More naive
logic would result in an unbounded, quadratic growth with each such
step.

Fixes #219.
2019-09-23 10:58:20 +00:00
whitequark a57b76fb5d lib.fifo: make simulation read() and write() functions compat-only.
These functions were originally changed in 3ed51938, in an attempt
to make them take one cycle instead of two. However, this does not
actually work because of drawbacks of the simulator interface.

Avoid committing to any specific implementation for now, and instead
make them compat-only extensions.
2019-09-23 08:46:12 +00:00
whitequark 1976310bf0 hdl.rec: fix using Enum subclass as shape if direction is specified.
Also improves error messages.

Fixes #224.
2019-09-22 17:23:32 +00:00
whitequark 4c582ef609 hdl.rec: allow using Enum subclass as shape.
Fixes #223.
2019-09-22 15:17:40 +00:00
whitequark 6414c80b82 lib.fifo: add more compatibility shims.
Some downstream code was broken by renames in da4b810f.
2019-09-22 11:56:03 +00:00
whitequark 59acd5d5a5 vendor.lattice_ice40: fix required tool list for iCECube2. NFC. 2019-09-22 07:18:37 +00:00
whitequark 5f9b8ec1eb vendor.lattice_ecp5: simplify quoting. NFC.
See commit ee1ad2da.
2019-09-22 07:17:12 +00:00
whitequark ee1ad2daf1 build.plat: restrict design names to alphanumeric to avoid quoting issues. 2019-09-22 06:57:28 +00:00
whitequark 3d62dac1cb vendor.lattice_ice40: add iCECube support.
This also makes some iCE40 and ECP5 overrides more consistent.
2019-09-21 14:45:17 +00:00
whitequark 8050cfaa98 build.res: simplify clock constraints.
Before this commit, it was possible to set and get clock constraints
placed on Pin objects. This was not a very good implementation, since
it relied on matching the identity of the provided Pin object to
a previously requested one. The only reason it worked like that is
deficiencies in nextpnr.

Since then, nextpnr has been fixed to allow setting constraints on
arbitrary nets. Correspondingly, backends that are using Synplify
were changed to use [get_nets] instead of [get_ports] in SDC files.
However, in some situations, Synplify does not allow specifying
ports in [get_nets]. (In fact, nextpnr had a similar problem, but
it has also been fixed.)

The simplest way to address this is to refer to the interior net
(after the input buffer), which always works. The only downside
of this is that requesting a clock as a raw pin using
    platform.request("clk", dir="-")
and directly applying a constraint to it could fail in some cases.
This is not a significant issue.
2019-09-21 14:12:29 +00:00
whitequark 07a82ed70e build.plat: NMIGEN_<toolchain>_env→NMIGEN_ENV_<toolchain>
This is more consistent with other environment variables nMigen uses.
2019-09-21 12:23:53 +00:00
whitequark 2dc6ae4ac5 lib.fifo: update docs. NFC. 2019-09-21 06:53:57 +00:00
whitequark a13a21cbd6 hdl.ast: update docs. NFC. 2019-09-21 06:53:13 +00:00
whitequark f6f0a7b692 lib.fifo: simplify. NFC. 2019-09-21 06:15:11 +00:00
whitequark a1bc2bbeb0 lib.fifo: fix doc typo. NFC. 2019-09-20 19:54:27 +00:00
whitequark f9b9c17a16 lib.fifo: work around Yosys issue with handling of \TRANSPARENT.
Because of YosysHQ/yosys#1390, using a transparent port in AsyncFIFO,
instead of being a no-op (as the semantics of \TRANSPARENT would
require it to be in this case), results in a failure to infer BRAM.

This can be easily avoided by using a non-transparent port instead,
which produces the desirable result with Yosys. It does not affect
the semantics on Xilinx platforms, since the interaction between
the two ports in case of address collision is undefined in either
transparent (WRITE_FIRST) or non-transparent (READ_FIRST) case, and
the data out of the write port is not used at all.

Fixes #172.
2019-09-20 19:54:27 +00:00
whitequark 4b3a068b15 hdl.mem: use 1 as reset value for ReadPort.en.
This is necessary for consistency, since for transparent read ports,
we currently do not support .en at all (it is fixed at 1) due to
YosysHQ/yosys#760. Before this commit, changing port transparency
would require adding or removing an assignment to .en, which is
confusing and error-prone.

Also, most read ports are always enabled, so this behavior is also
convenient.
2019-09-20 19:51:13 +00:00
whitequark 91ef2f58e3 vendor.lattice_{ecp5,ice40}: allow clock constraints on arbitrary signals.
Fixes #88.
2019-09-20 16:26:27 +00:00
whitequark 378e924280 hdl.ast: rename nbits to width.
Also, replace `bits, sign = x.shape()` with more idiomatic
`width, signed = x.shape()`.

This unifies all properties corresponding to `len(x)` to `x.width`.
(Not all values have a `width` property.)

Fixes #210.
2019-09-20 15:36:25 +00:00
Darrell Harmon af7224de5d vendor.xilinx_{7series,spartan3_6}: specialize MultiReg.
Vivado/ISE would otherwise infer an SRL16 from a MultiReg in some cases.
2019-09-20 15:13:27 +00:00
whitequark 276e9c2fad test.test_lib_fifo: fix typo. 2019-09-20 11:53:05 +00:00
whitequark 7f6b3f93f5 back.pysim: fix simulation of Value.xor(). 2019-09-20 10:12:59 +00:00
whitequark 4777a7b3a2 hdl.{ast,dsl}: add Signal.enum; coerce Enum to Value; accept Enum patterns.
Fixes #207.
2019-09-16 19:22:12 +00:00
whitequark e8f79c5539 hdl.ast: add Value.matches(), accepting same language as Case().
Fixes #202.
2019-09-14 21:06:12 +00:00
whitequark f292a1977c hdl.dsl: improve error messages for Case(). 2019-09-14 20:58:19 +00:00
whitequark 32310aecad hdl.ast: add Value.xor, mapping to $reduce_xor.
Fixes #147.
2019-09-13 14:29:46 +00:00
whitequark b23a9794a4 hdl.ast: add Value.{any,all}, mapping to $reduce_{or,and}.
Refs #147.
2019-09-13 13:14:52 +00:00
whitequark bdb70ad45f lib.fifo: adjust for new CDC primitive conventions.
Fixes #97.
2019-09-13 12:36:51 +00:00
whitequark da4b810fe1 lib.fifo: adjust properties to have consistent naming. 2019-09-13 12:33:41 +00:00
whitequark 9ea3ff7ae2 build.plat: bypass tool detection if NMIGEN_*_env is set.
It's not practical to detect tools within the toolchain environment
for various reasons, so just assume the tools are there if the user
says they are.

Before this commit, the tools would be searched outside the toolchain
environment, which of course would always fail for Vivado, ISE, etc.
2019-09-12 21:56:48 +00:00
whitequark c8f8c09f29 vendor.xilinx_7series: Vivado requires bash on *nix as well. 2019-09-12 21:49:08 +00:00
whitequark 42805ad959 hdl.mem: use keyword-only arguments as appropriate. 2019-09-12 20:03:48 +00:00
whitequark b92e967b78 lib.fifo: make fwft a keyword-only argument.
Because it accepts a boolean.
2019-09-12 19:38:18 +00:00
whitequark 1c091e67a4 lib.fifo: remove SyncFIFO.replace.
This obscure functionality was likely only ever used in old MiSoC
code, and doesn't justify the added complexity. It was also not
provided (and could not be reasonably provided) in SyncFIFOBuffered,
which made its utility extremely marginal.
2019-09-12 19:16:57 +00:00
whitequark 2d2ab6e09d lib.cdc: make domain properties private.
It is not correct to access domain properties from user code, because
it will not match the reality if DomainRenamer has been applied to
the module.
2019-09-12 13:54:48 +00:00
whitequark 73244f2bd2 lib.io: style. NFC. 2019-09-12 13:51:18 +00:00
whitequark 9893e3c044 lib.cdc: adjust ResetSynchronizer for new CDC primitive conventions.
Refs #97.
2019-09-12 13:48:45 +00:00
whitequark 8f659b6cd6 lib.cdc: adjust MultiReg for new CDC primitive conventions.
Refs #97.
2019-09-12 13:48:24 +00:00
whitequark 8c30147e39 build.plat,vendor: allow clock constraints on arbitrary signals.
Currently only done for Synopsys based toolchains (i.e. not nextpnr).

Refs #88.
2019-09-11 23:35:43 +00:00
whitequark d1779bdb59 back: return name map from convert_fragment(). 2019-09-11 23:22:12 +00:00
whitequark 7342662bee hdl.ast: warn if reset value is truncated.
Fixes #183.
2019-09-10 07:26:34 +00:00
Darrell Harmon 27cedf4302 vendor.lattice_ecp5: pass ecppack_opts to ecppack. 2019-09-10 03:32:36 +00:00
whitequark 9b398b502e hdl.ast: check type of Sample(domain=...).
Fixes #199.
2019-09-08 23:55:05 +00:00
whitequark 3f6abc0b7a hdl.dsl: add Default(), an alias for Case() with no arguments.
Fixes #197.
2019-09-08 12:24:18 +00:00
whitequark eb04a2509e hdl.mem,lib,examples: use Signal.range(). 2019-09-08 12:19:13 +00:00
whitequark ccfbccc044 hdl.ast: add Signal.range(...), to replace Signal(min=..., max=...).
Fixes #196.
2019-09-08 12:10:31 +00:00
whitequark 5e9587bbbd Remove nmigen.lib from prelude.
Currently it's just MultiReg, and there's no particularly good reason
to privilege this specific CDC primitive so much.
2019-09-06 06:53:06 +00:00
whitequark 284b533995 setup: replace versioneer with setuptools_scm.
Has the same problems with git-archive but is much less invasive.
2019-09-06 05:20:42 +00:00
whitequark 943ce317af hdl.ast,back.rtlil: implement Cover.
Fixes #194.
2019-09-03 01:32:24 +00:00
whitequark 2e20622046 hdl.cd: add negedge clock domains.
Fixes #185.
2019-08-31 22:05:48 +00:00
Emily c4e8ac734f _toolchain,build.plat,vendor.*: add required_tools list and checks. 2019-08-31 00:05:47 +00:00
whitequark 4e91710933 vendor.lattice_ecp5: drive GSR synchronous to user clock by default.
Fixes #167.
2019-08-30 14:26:49 +00:00
whitequark a4b58cbf3a build.dsl: allow both str and int resource attributes. 2019-08-30 08:35:52 +00:00
Emily 98278a044d test.tools: use _toolchain.get_tool. 2019-08-28 11:52:16 +00:00
whitequark b14f5572d8 _toolchain: new module, for injecting dependencies in e.g. Nix. 2019-08-28 11:32:18 +00:00
whitequark 2168ff512b back.verilog: bump Yosys version requirement to 0.9.
Fixes #55.
2019-08-26 09:59:40 +00:00
whitequark b4b5d9e2ef vendor.lattice_ecp5: revert default toolchain to Trellis.
This was unintentionally changed in 7fc1058e.
2019-08-25 08:07:00 +00:00
whitequark 72cf4ca991 back.pysim: implement sim.add_clock(if_exists=True). 2019-08-23 08:53:48 +00:00
whitequark 906385c7f8 back.pysim: don't crash when trying to drive a nonexistent domain clock. 2019-08-23 08:37:59 +00:00
whitequark 9350620f89 build.run: add BuildPlan.digest(), useful for caching. 2019-08-23 01:10:51 +00:00
whitequark 7fc1058ed2 vendor.lattice_ecp5: add Diamond support. 2019-08-22 21:36:24 +00:00
whitequark c77274c1ad vendor: eliminate unnecessary LUT instantiation.
Fixes #165.
2019-08-22 21:29:20 +00:00
whitequark 47bad3d20e back.rtlil: print real parameters with maximum precision. 2019-08-22 04:42:30 +00:00
Darrell Harmon aefde85031 back.rtlil: add support for real (float) parameters on Instances.
Required for Xilinx MMCME2_BASE, etc.
2019-08-22 04:13:05 +00:00
Darrell Harmon 6737ef79f9 vendor.xilinx_series7: use STARTUPE2, not STARTUPE3.
STARTUPE3 is for Ultrascale.
2019-08-21 22:25:55 +00:00
whitequark 5889e62668 vendor.lattice_ice40: remove --placer heap default option.
It is not the place of nMigen to decide on this default, since both
SA and HeAP have valid uses that are not covered by the other.
2019-08-21 21:32:38 +00:00
whitequark 531040d2fd vendor: style. NFC. 2019-08-21 21:32:36 +00:00
whitequark 25b280dba1 build.plat: remove TemplatedPlatform.unix_interpreter.
Vendor toolchains generally require far more workarounds than this,
and we already have a perfectly fine way of overriding templates.
2019-08-21 21:02:13 +00:00
whitequark 1fc63a62c0 back.pysim: allow coroutines as processes.
This is a somewhat obscure use case, but it is possible to use async
functions with pysim by carefully using @asyncio.coroutine. That is,
async functions can call back into pysim if they are declared in
a specific way:

  @asyncio.coroutine
  def do_something(self, value):
    yield self.reg.eq(value)

which may then be called from elsewhere with:

  async def test_case(self):
    await do_something(0x1234)

This approach is unfortunately limited in that async functions
cannot yield directly. It should likely be improved by using async
generators, but supporting coroutines in pysim is unobtrustive and
allows existing code that made use of this feature in oMigen to work.
2019-08-21 03:30:37 +00:00
William D. Jones c934fc66e9 test.test_examples: Convert pathlib-specific class to string.
subprocess.check_call iterates over its arguments to check for spaces
and tabs, and on Windows, the pathlib-specific WindowsPath is not
iterable.
2019-08-20 00:54:10 +00:00
whitequark 5ad409e897 back.verilog: parse output of yosys -V.
See #55.
2019-08-19 23:28:33 +00:00
whitequark 7ca29a5748 Fix nmigen.__version__ to work on git-archive artifacts.
Fixes #137.
2019-08-19 23:14:41 +00:00
whitequark 13316053e3 build.plat, hdl.ir: coordinate missing domain creation.
Platform.prepare() was completely broken after addition of local
clock domains, and only really worked before by a series of
accidents because there was a circular dependency between creation
of missing domains, fragment preparation, and insertion of pin
subfragments.

This commit untangles the dependency by adding a separate public
method Fragment.create_missing_domains(), used in build.plat.

It also makes DomainCollector consider both used and defined domains,
such that it will work on fragments before domain propagation, since
create_missing_domains() can be called by user code before prepare().

The fragment driving missing clock domain is not flattened anymore,
because flattening does not work well combined with local domains.
2019-08-19 22:52:01 +00:00
whitequark 77012fc143 vendor.lattice_ice40: use a local clock domain in create_missing_domain(). 2019-08-19 21:46:44 +00:00
whitequark a069d975b2 lib.cdc: use a local clock domain in ResetSynchronizer.
This reverts commit 779f3ee906.
This reverts commit 300d47ca2e.
This reverts commit 9c54d0c061.
2019-08-19 21:45:08 +00:00
whitequark 003ba3b45f hdl.cd: implement local clock domains.
Closes #175.
2019-08-19 21:44:33 +00:00
whitequark 9bdadbff09 back.pysim: index domains by identity, not by name.
Changed in preparation for introducing local clock domains.
2019-08-19 21:44:33 +00:00
whitequark 69d36dc139 hdl.xfrm: lower resets in DomainLowerer as well.
Changed in preparation for introducing local clock domains.

Also makes elaboration about 15% faster.
2019-08-19 21:44:30 +00:00
whitequark 404f99f022 hdl.xfrm: consider fragment's own domains in DomainLowerer.
Changed in preparation for introducing local clock domains.
2019-08-19 21:07:02 +00:00
whitequark 32bfbb11cb formal→asserts
Closes #171.
2019-08-19 20:23:24 +00:00
whitequark 2770db6de8 tracer: fix typo.
Introduced in 62b3e366.
2019-08-19 20:20:18 +00:00
whitequark ada1d6a603 build.plat: do not prepare fragments twice.
Fixes #169.
2019-08-19 19:49:51 +00:00
whitequark a2241fcfdb back.{rtlil,verilog}: split convert_fragment() off convert().
Because Fragment.prepare is not (currently) idempotent, it is useful
to be able to avoid calling it when converting. Even if it is made
idempotent, it can be slow on large designs, so it is advantageous
regardless of that.
2019-08-19 19:49:51 +00:00
Robin Heinemann 8e048c5a7c build.dsl: add conn argument to Connector. 2019-08-18 19:56:25 +00:00
whitequark 84f2c3df2b compat.fhdl.decorators: avoid using deprecated NativeCEInserter. 2019-08-18 16:27:11 +00:00
whitequark d44ea4e9fe hdl.xfrm: make deprecated CEInserter more well-behaved. 2019-08-18 16:26:45 +00:00
whitequark ed7e07c6c1 hdl.ast: implement Initial.
This is the last remaining part for first-class formal support.
2019-08-15 02:53:07 +00:00
whitequark 40abaef858 hdl.xfrm: sample cache should be per-fragment. 2019-08-15 02:45:31 +00:00
whitequark fa0fa056ba hdl.xfrm: CEInserter→EnableInserter.
Fixes #166.
2019-08-12 13:39:26 +00:00
whitequark 9d2cbbabb8 hdl.ast: hash-cons ValueKey.
This speeds up elaboration by ~10%.
2019-08-08 10:56:53 +00:00
whitequark 4ee82c9584 tracer: use sys._getframe directly.
This speeds up elaboration by ~30-40%.
2019-08-08 10:23:35 +00:00
whitequark e6b1e3de1a compat.fhdl.decorators: port from oMigen. 2019-08-08 08:09:28 +00:00
whitequark 5c626e33bf compat.fhdl.module: fix finalization of transformed compat submodules.
Before this commit, the TransformedElaboratable of a CompatModule
would be ignored, and .get_fragment() would be used to retrieve
the CompatModule within.

After this commit, the finalization process is reworked to match
oMigen's finalization closely, and all submodules, native and compat,
are added in the same way that preserves applied transforms.
2019-08-08 07:45:34 +00:00
whitequark 1b379a513c vendor.lattice_ice40: add iCE5LP2K support. 2019-08-07 09:25:20 +00:00
whitequark cfbc678508 vendor.lattice_ice40: add iCE40UP3K support. 2019-08-07 09:06:27 +00:00
whitequark 9c35e44e4a vendor.lattice_ice40: add iCE5LP1K support. 2019-08-07 09:01:11 +00:00
whitequark 434b686d5e vendor.xilinx_{spartan_3_6,7series}: reconsider default reset logic.
On Xilinx devices, flip-flops are reset to their initial state with
an internal global reset network, but this network is deasserted
asynchronously to user clocks. Use BUFGCE and STARTUP to hold default
clock low until after GWE is deasserted.
2019-08-04 23:28:09 +00:00
whitequark 3d7214cb70 vendor.xilinx_spartan_3_6: reconsider bitgen defaults.
Previously changed in 27063a3b.

I haven't realized the .bin file is the same as the .bit file without
a small header. That means generating it is free and it's just easier
to let programming tools to be able to always rely on its existence.
2019-08-04 23:28:09 +00:00
whitequark 27063a3bd3 vendor.xilinx_spartan_3_6: set bitgen defaults to -g Binary:Yes -g Compress.
* `-g Binary:Yes` should be overridable.
  * `-g Compress` is a good default.
2019-08-04 14:18:49 +00:00
whitequark 65da905c15 vendor.xilinx_spartan_3_6: always use -w for map/par/bitgen.
-w stands for "override output file", and supplying user options
should not remove it.
2019-08-04 14:12:02 +00:00
whitequark 15e8dfe532 vendor.xilinx_spartan_3_6: do not use retiming by default.
This was added in b404d603, probably by mistake, and is certainly
wrong given that we do not (yet) correctly mark CDC FFs.
2019-08-04 13:48:33 +00:00
whitequark 6b025df12c vendor.xilinx_spartan_3_6: force use of bash on UNIX. 2019-08-04 13:20:54 +00:00
whitequark 5eb4e2ee51 build.plat: allow selecting a specific UNIX shell interpreter.
Mostly because vendor tools have bashisms.
2019-08-04 13:20:54 +00:00
whitequark 34a97b2751 vendor.lattice_ice40: avoid routing conflicts with SDR/DDR input pins. 2019-08-04 00:30:50 +00:00
whitequark 2e6627c4af back.rtlil: use a dummy wire, not 'x, when assigning to shorter LHS.
Using 'x is legal RTLIL, in theory, but in practice it crashes Yosys
and when it doesn't, it causes Yosys to produce invalid Verilog.
Using a dummy wire is always safe and is not a major readability
issue as this is a rare corner case.

(It is not trivial to shorten the RHS in this case, because during
expansion of an ArrayProxy, match_shape() could be called in
a context far from the RHS handling logic.)
2019-08-04 00:12:08 +00:00
whitequark d0ac8bf789 back.rtlil: actually match shape of left hand side.
This comes up in code such as:
  Array([Signal(1), Signal(8)]).eq(Const(0, 8))
2019-08-03 23:48:28 +00:00
whitequark 999a2f612a vendor.lattice_ice40: add missing signal indexing. 2019-08-03 22:59:33 +00:00
whitequark 8dd54ac544 build.run: use keyword-only arguments where appropriate. 2019-08-03 22:52:58 +00:00
whitequark 0fe05188e8 compat.fhdl.specials: track changes in build.plat. 2019-08-03 22:52:34 +00:00
whitequark 99d205494a hdl.dsl: reword m.If(~True) warning to be more clear.
Before this commit, it only suggested one thing (silencing it) and
that's wrong almost all of the time, so suggest the right thing
instead.
2019-08-03 18:52:24 +00:00
whitequark 8854ca03ae build.plat,vendor: automatically create sync domain from default_clk.
But only if it is not defined by the programmer.

Closes #57.
2019-08-03 18:36:58 +00:00
whitequark e0b54b417e hdl.ir: allow adding more than one domain in missing domain callback.
This is useful for injecting complex power-on reset logic.
2019-08-03 18:19:40 +00:00
whitequark 9c28b61d9f hdl.ir: don't expose as ports missing domains added via elaboratables.
The elaboratable is already likely driving the clk/rst signals in
some way appropriate for the platform; if we expose them as ports
nevertheless it will cause problems downstream.
2019-08-03 16:39:21 +00:00
whitequark 21f2f8c46e build.plat: add default_rst, to be used with default_clk. 2019-08-03 16:28:03 +00:00
whitequark 4dbb5352ad build.plat: add default_clk{,_constraint,_frequency}.
This is the equivalent of oMigen's default_clk and default_clk_period
except the period is taken from the resource.
2019-08-03 16:18:46 +00:00
whitequark cea92e9531 hdl.ir: allow returning elaboratables from missing domain callback.
This allows e.g. injecting a clock/reset generator in platform build
code on demand (i.e. if the domain is not instantiated manually).

See #57.
2019-08-03 15:44:02 +00:00
whitequark fc846532c7 hdl.ir: raise DomainError if a domain is used but not defined.
Before this commit, a KeyError would be raised elsewhere in guts of
hdl.ir, which is not helpful.
2019-08-03 15:31:24 +00:00
whitequark fdb0c5a6bc hdl.ir: call back from Fragment.prepare if a clock domain is missing.
See #57.
2019-08-03 14:54:20 +00:00
whitequark ace2b5ff0a hdl.dsl: warn on suspicious statements like m.If(~True):.
This pattern usually produces an extremely hard to notice bug that
will usually break a design when it is triggered, but will also be
hidden unless the pathological value of a boolean switch is used.

Fixes #159.
2019-08-03 14:00:29 +00:00
whitequark ab5426ce74 Improve test added in 29fee01f to not leak warnings. 2019-08-03 13:44:44 +00:00
whitequark ee03eab52f back.rtlil: fix sim-synth mismatch with assigns following switches.
Closes #155.
2019-08-03 13:27:47 +00:00
whitequark 0a603b3844 hdl.ast: fix typo. 2019-08-03 13:21:09 +00:00
whitequark 94e13effad hdl.ast: deprecate Value.part, add Value.{bit,word}_select.
Fixes #148.
2019-08-03 13:07:06 +00:00