whitequark
97cc78a3db
hdl.ir: type check ports.
...
Fixes #290 .
2020-02-06 17:33:41 +00:00
whitequark
a7be3b480a
hdl.ir: resolve hierarchy conflicts before creating missing domains.
...
Otherwise, code such as:
m.submodules.a = (something with cd_sync)
m.submodules.b = (something with cd_sync)
m.d.b_sync += x.eq(y)
causes an assertion failure.
Fixes #304 (again).
2020-01-18 10:30:36 +00:00
whitequark
7cb3095334
hdl.xfrm: transform drivers as well in DomainRenamer.
...
This is necessary because drivers may be late bound.
Fixes #304 .
2020-01-17 02:13:46 +00:00
whitequark
56bb42aff2
hdl.ir: for instance ports, prioritize defs over uses.
...
Fixes #274 .
2019-11-26 21:19:03 +00:00
whitequark
9749c70730
hdl.ir: lower domains before resolving hierarchy conflicts.
...
Otherwise, two subfragments with the same local clock domain would
not be able to drive its clock or reset signals. This can be easily
hit if using two ResetSynchronizers in one module.
Fixes #265 .
2019-11-07 08:20:27 +00:00
whitequark
75d0fcd639
test: use #nmigen:
magic comment instead of monkey patch.
...
Also, fix missing and incorrect src_loc_at arguments where
appropriate so the testsuite passes without warnings.
2019-10-26 06:37:08 +00:00
whitequark
2f9dab361f
{,_}tools→{,_}utils
...
In context of nMigen, "tools" means "parts of toolchain", so it is
confusing to have a completely unrelated module also called "tools".
2019-10-13 18:53:38 +00:00
whitequark
29253295ee
hdl.ir: allow ClockSignal and ResetSignal in ports.
...
Fixes #248 .
2019-10-13 03:39:56 +00:00
whitequark
722b3879f4
hdl.ir: cast instance port connections to Values.
...
Fixes #249 .
2019-10-13 03:19:17 +00:00
whitequark
db960e7c30
Consistently use {!r}, not '{!r}' in diagnostics.
...
This can cause confusion:
* If the erroneous object is None, it is printed as 'None', which
appears as a string (and could be the result of converting None
to a string.)
* If the erroneous object is a string, it is printed as ''<val>'',
which is a rather strange combination of quotes.
2019-10-11 11:47:42 +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
003ba3b45f
hdl.cd: implement local clock domains.
...
Closes #175 .
2019-08-19 21:44:33 +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
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
ab5426ce74
Improve test added in 29fee01f
to not leak warnings.
2019-08-03 13:44:44 +00:00
whitequark
29fee01f86
hdl.ir: warn if .elaborate() returns None.
...
Fixes #164 .
2019-08-03 12:30:39 +00:00
whitequark
48d4ee4031
hdl.ir, back.rtlil: allow specifying attributes on instances.
...
Fixes #107 .
2019-06-28 04:14:38 +00:00
whitequark
c6a0761b3a
hdl.ir: accept LHS signals like slices as Instance io ports.
...
This is unlikely to work with anything except Slice and Cat, but
there's no especially good place to enforce it. (Maybe in Instance?)
2019-06-03 02:39:14 +00:00
whitequark
b64a31255c
hdl.ir: accept expanded (kind, name, value) tuples in Instance.
...
This is useful for e.g. programmatically generating parameters
without having to mess with kwargs dicts.
2019-06-03 02:12:01 +00:00
whitequark
3392708e2b
Consider Instances a part of containing fragment for use-def purposes.
...
Fixes #70 .
2019-05-25 20:13:43 +00:00
whitequark
c337246fc5
hdl.ir: when adding sync domain to a design, also add it to ports.
...
Otherwise we end up in a situation where the examples don't have
clk and rst as ports, which is not nice.
Fixes #67 .
2019-05-15 06:44:50 +00:00
whitequark
39bc59c924
hdl.ir: during port propagation, defs should take priority over uses.
2019-05-13 15:34:13 +00:00
whitequark
958cb18b88
hdl.ir: only pull explicitly specified ports to toplevel, if any.
...
Fixes #30 .
2019-05-12 05:21:23 +00:00
whitequark
585514e6ed
hdl.ir: rework named port handling for Instances.
...
The main purpose of this rework is cleanup, to avoid specifying
the direction of input ports in an implicit, ad-hoc way using
the named ports and ports dictionaries.
While working on this I realized that output ports can be connected
to anything that is valid on LHS, so this is now supported too.
2019-04-22 07:46:47 +00:00
whitequark
8ee6bd80ff
hdl.ir: raise a more descriptive error on non-elaboratable object.
2019-02-14 20:52:42 +00:00
whitequark
4948162f33
hdl.ir: rename .get_fragment() to .elaborate().
...
Closes #9 .
2019-01-26 02:31:12 +00:00
whitequark
b534e92dd5
hdl.ir: allow explicitly requesting flattening.
2019-01-14 17:04:23 +00:00
whitequark
040811c2e5
hdl.ir: add an API for retrieving generated values, like FSM signal.
...
This is useful for tests.
2018-12-26 12:35:35 +00:00
whitequark
68dae9f50e
hdl.ir: flatten hierarchy based on memory accesses, too.
2018-12-22 21:43:46 +00:00
whitequark
f6772759c8
hdl.ir: fix port propagation between siblings, in the other direction.
2018-12-22 00:31:31 +00:00
whitequark
913339c04a
hdl.ir: fix port propagation between siblings.
2018-12-21 23:53:18 +00:00
whitequark
b0bd7bfaca
hdl.ir: correctly handle named output and inout ports.
2018-12-21 04:03:03 +00:00
whitequark
f7fec804ec
ir: allow non-Signals in Instance ports.
2018-12-20 23:40:40 +00:00
whitequark
c7f9386eab
fhdl.ir: add black-box fragments, fragment parameters, and Instance.
2018-12-17 22:55:39 +00:00
whitequark
8d1639a5a8
hdl, back: add and use SignalSet/SignalDict.
2018-12-17 17:21:29 +00:00
whitequark
c6e7a93717
hdl: appropriately rename tests. NFC.
2018-12-15 16:13:53 +00:00