2018-12-15 04:51:09 -07:00
Migen and nMigen compatibility summary
======================================
nMigen intends to provide as close to 100% compatibility to Migen as possible without compromising its other goals. However, Migen widely uses `*` imports, tends to expose implementation details, and in general does not have a well-defined interface. This document attempts to elucidate a well-defined Migen API surface (including, when necessary, private items that have been used downstream), and describes the intended nMigen replacements and their implementation status.
API change legend:
- *id*: identical
2019-10-12 17:15:09 -06:00
- *obs*: removed or incompatibly changed with compatibility stub provided
- *obs →n*: removed or incompatibly changed with compatibility stub provided, use *n* instead
- *brk*: removed or incompatibly changed with no replacement provided
- *brk →n*: removed or incompatibly changed with no replacement provided, use *n* instead
2018-12-15 04:51:09 -07:00
- *→n*: renamed to *n*
- *⇒m*: merged into *m*
- *a=→b=*: parameter *a* renamed to *b*
- *a=∼ *: parameter *a* removed
- *.a=→.b*: attribute *a* renamed to *b*
2019-01-18 18:01:32 -07:00
- *.a=∼ *: attribute *a* removed
2018-12-15 04:51:09 -07:00
- *?*: no decision made yet
When describing renames or replacements, `mod` refers to a 3rd-party package `mod` (no nMigen implementation provided), `.mod.item` refers to `nmigen.mod.item` , and "(import `.item` )" means that, while `item` is provided under `nmigen.mod.item` , it is aliased to, and should be imported from a shorter path for readability.
Status legend:
2018-12-15 05:04:52 -07:00
- (− ) No decision yet, or no replacement implemented
- (+) Implemented replacement (the API and/or compatibility shim are provided)
- (⊕) Verified replacement and/or compatibility shim (the compatibility shim is manually reviewed and/or has 100% test coverage)
- (⊙) No direct replacement or compatibility shim is provided
2018-12-15 04:51:09 -07:00
Compatibility summary
---------------------
2018-12-15 07:23:42 -07:00
- (− ) `fhdl` → `.hdl`
2019-10-12 17:15:09 -06:00
- (⊕) `bitcontainer` ⇒ `.tools`
- (⊕) `log2_int` id
- (⊕) `bits_for` id
- (⊕) `value_bits_sign` → `Value.shape`
- (⊕) `conv_output` **obs**
- (⊕) `decorators` ⇒ `.hdl.xfrm`
2018-12-15 05:07:56 -07:00
< br > Note: `transform_*` methods not considered part of public API.
2018-12-15 05:04:52 -07:00
- (⊙) `ModuleTransformer` **brk**
- (⊙) `ControlInserter` **brk**
2019-10-12 17:15:09 -06:00
- (⊕) `CEInserter` → `EnableInserter`
- (⊕) `ResetInserter` id
- (⊕) `ClockDomainsRenamer` → `DomainRenamer` , `cd_remapping=` →`domain_map=`
2018-12-15 05:04:52 -07:00
- (⊙) `edif` **brk**
2019-10-12 17:15:09 -06:00
- (⊕) `module` **obs** → `.hdl.dsl`
< br > Note: any class inheriting from `Module` in oMigen should inherit from `Elaboratable` in nMigen and use an nMigen `Module` in its `.elaborate()` method.
- (⊕) `FinalizeError` **obs**
- (⊕) `Module` **obs** → `.hdl.dsl.Module`
2018-12-15 05:04:52 -07:00
- (⊙) `namer` **brk**
2019-10-12 17:15:09 -06:00
- (⊙) `simplify` **brk**
2019-01-18 18:01:32 -07:00
- (⊕) `specials` **obs**
- (⊙) `Special` **brk**
2019-10-12 17:15:09 -06:00
- (⊕) `Tristate` **obs**
- (⊕) `TSTriple` **obs** → `.lib.io.Pin`
2019-01-18 18:01:32 -07:00
- (⊕) `Instance` → `.hdl.ir.Instance`
- (⊕) `Memory` id
2019-10-12 17:15:09 -06:00
< br > Note: nMigen memories should not be added as submodules.
2019-01-18 18:01:32 -07:00
- (⊕) `.get_port` **obs** → `.read_port()` + `.write_port()`
2019-10-12 17:15:09 -06:00
- (⊕) `_MemoryPort` **obs** → `.hdl.mem.ReadPort` + `.hdl.mem.WritePort`
2019-01-18 18:01:32 -07:00
- (⊕) `READ_FIRST` /`WRITE_FIRST` **obs**
2018-12-20 18:53:32 -07:00
< br > Note: `READ_FIRST` corresponds to `mem.read_port(transparent=False)` , and `WRITE_FIRST` to `mem.read_port(transparent=True)` .
2019-01-18 18:01:32 -07:00
- (⊙) `NO_CHANGE` **brk**
2019-10-12 17:15:09 -06:00
< br > Note: in designs using `NO_CHANGE` , replace it with logic implementing required semantics explicitly, or with a different mode.
- (⊕) `structure` → `.hdl.ast`
- (⊕) `DUID` id
- (⊕) `_Value` → `Value`
2018-12-15 05:07:56 -07:00
< br > Note: values no longer valid as keys in `dict` and `set` ; use `ValueDict` and `ValueSet` instead.
2019-10-12 17:15:09 -06:00
- (⊕) `wrap` → `Value.cast`
- (⊕) `_Operator` → `Operator` , `op=` →`operator=`, `.op` →`.operator`
- (⊕) `Mux` id
- (⊕) `_Slice` → `Slice` id
- (⊕) `_Part` → `Part` id
- (⊕) `Cat` id, `.l` →`.parts`
- (⊕) `Replicate` → `Repl` , `v=` →`value=`, `n=` →`count=`, `.v` →`.value`, `.n` →`.count`
- (⊕) `Constant` → `Const` , `bits_sign=` →`shape=`, `.nbits` →`.width`
- (⊕) `Signal` id, `bits_sign=` →`shape=`, `attr=` →`attrs=`, `name_override=` ∼ , `related=` , `variable=` ∼ , `.nbits` →`.width`
- (⊕) `ClockSignal` id, `cd=` →`domain=`, `.cd` →`.domain`
- (⊕) `ResetSignal` id, `cd=` →`domain=`, `.cd` →`.domain`
- (⊕) `_Statement` → `Statement`
- (⊕) `_Assign` → `Assign` , `l=` →`lhs=`, `r=` →`rhs=`
- (⊕) `_check_statement` **obs** → `Statement.cast`
- (⊕) `If` **obs** → `.hdl.dsl.Module.If`
- (⊕) `Case` **obs** → `.hdl.dsl.Module.Switch`
- (⊕) `_ArrayProxy` → `.hdl.ast.ArrayProxy` , `choices=` →`elems=`, `key=` →`index=`
- (⊕) `Array` id
- (⊕) `ClockDomain` → `.hdl.cd.ClockDomain`
- (⊙) `_ClockDomainList` **brk**
- (⊙) `SPECIAL_INPUT` /`SPECIAL_OUTPUT`/`SPECIAL_INOUT` **brk**
2018-12-15 07:23:42 -07:00
- (⊙) `_Fragment` **brk** → `.hdl.ir.Fragment`
2019-10-12 17:15:09 -06:00
- (⊙) `tools` **brk**
2018-12-15 07:23:42 -07:00
- (⊙) `insert_resets` **brk** → `.hdl.xfrm.ResetInserter`
- (⊙) `rename_clock_domain` **brk** → `.hdl.xfrm.DomainRenamer`
2019-10-12 17:15:09 -06:00
- (⊙) `tracer` **brk**
- (⊕) `get_var_name` → `.tracer.get_var_name`
- (⊙) `remove_underscore` **brk**
- (⊙) `get_obj_var_name` **brk**
- (⊙) `index_id` **brk**
- (⊙) `trace_back` **brk**
- (⊙) `verilog`
- (⊙) `DummyAttrTranslate` ?
- (⊕) `convert` **obs** → `.back.verilog.convert`
2018-12-15 07:23:42 -07:00
- (⊙) `visit` **brk** → `.hdl.xfrm`
2018-12-15 05:04:52 -07:00
- (⊙) `NodeVisitor` **brk**
2018-12-15 07:23:42 -07:00
- (⊙) `NodeTransformer` **brk** → `.hdl.xfrm.ValueTransformer` /`.hdl.xfrm.StatementTransformer`
- (− ) `genlib` → `.lib`
2018-12-15 05:04:52 -07:00
- (− ) `cdc` ?
2019-10-12 17:15:09 -06:00
- (⊙) `MultiRegImpl` **brk**
- (⊕) `MultiReg` → `.lib.cdc.FFSynchronizer`
2018-12-15 05:04:52 -07:00
- (− ) `PulseSynchronizer` ?
- (− ) `BusSynchronizer` ?
2019-01-19 19:29:08 -07:00
- (⊕) `GrayCounter` **obs** → `.lib.coding.GrayEncoder`
- (⊕) `GrayDecoder` **obs** → `.lib.coding.GrayDecoder`
< br > Note: `.lib.coding.GrayEncoder` and `.lib.coding.GrayDecoder` are purely combinatorial.
2018-12-15 05:04:52 -07:00
- (− ) `ElasticBuffer` ?
- (− ) `lcm` ?
- (− ) `Gearbox` ?
2018-12-26 06:19:34 -07:00
- (⊕) `coding` id
- (⊕) `Encoder` id
- (⊕) `PriorityEncoder` id
- (⊕) `Decoder` id
- (⊕) `PriorityDecoder` id
2018-12-15 05:04:52 -07:00
- (− ) `divider` ?
- (− ) `Divider` ?
2019-10-12 17:15:09 -06:00
- (⊕) `fifo` → `.lib.fifo`
2019-01-18 18:01:32 -07:00
- (⊕) `_FIFOInterface` → `FIFOInterface`
2019-10-12 17:15:09 -06:00
- (⊕) `SyncFIFO` id, `.replace=` ∼
2019-01-18 18:01:32 -07:00
- (⊕) `SyncFIFOBuffered` id, `.fifo=` ∼
2019-10-12 17:15:09 -06:00
- (⊕) `AsyncFIFO` ?
- (⊕) `AsyncFIFOBuffered` , `.fifo=` ∼
- (⊕) `fsm` **obs**
< br > Note: FSMs are a part of core nMigen DSL; however, not all functionality is provided. The compatibility shim is a complete port of Migen FSM module.
- (⊙) `io` **brk**
< br > Note: all functionality in this module is a part of nMigen platform system.
2018-12-15 05:04:52 -07:00
- (− ) `misc` ?
- (− ) `split` ?
- (− ) `displacer` ?
- (− ) `chooser` ?
- (− ) `timeline` ?
- (− ) `WaitTimer` ?
- (− ) `BitSlip` ?
2019-10-12 17:15:09 -06:00
- (⊕) `record` **obs** → `.hdl.rec.Record`
< br > Note: nMigen uses a `Layout` object to represent record layouts.
- (⊕) `DIR_NONE` id
- (⊕) `DIR_M_TO_S` → `DIR_FANOUT`
- (⊕) `DIR_S_TO_M` → `DIR_FANIN`
- (⊕) `Record` id
- (⊙) `set_layout_parameters` **brk**
- (⊙) `layout_len` **brk**
- (⊙) `layout_get` **brk**
- (⊙) `layout_partial` **brk**
- (⊕) `resetsync` **obs**
- (⊕) `AsyncResetSynchronizer` **obs** → `.lib.cdc.ResetSynchronizer`
2018-12-15 05:04:52 -07:00
- (− ) `roundrobin` ?
- (− ) `SP_WITHDRAW` /`SP_CE` ?
- (− ) `RoundRobin` ?
- (− ) `sort` ?
- (− ) `BitonicSort` ?
2019-10-12 17:15:09 -06:00
- (⊕) `sim` **obs** → `.back.pysim`
2018-12-15 05:07:56 -07:00
< br > Note: only items directly under `nmigen.compat.sim` , not submodules, are provided.
2018-12-15 05:04:52 -07:00
- (⊙) `core` **brk**
- (⊙) `vcd` **brk** → `vcd`
- (⊙) `Simulator` **brk**
2018-12-18 11:05:37 -07:00
- (⊕) `run_simulation` **obs** → `.back.pysim.Simulator`
- (⊕) `passive` **obs** → `.hdl.ast.Passive`
2019-10-12 17:15:09 -06:00
- (⊙) `build` **brk**
< br > Note: the build system has been completely redesigned in nMigen.
- (⊙) `util` **brk**