cli: mark required applet arguments as such.
Closes #203.
by
whitequark
4 years 2 months
applet.interface.uart: fix auto-baud detection
This patch addresses two issues that prevented the UART auto-baud from
operating correctly:
1. It is critically imporant that `UART.bit_cyc` is never set to zero,
doing so will render the UART gateware inoperable. To avoid this,
the `auto_cyc` register is set to "all 1s" at reset.
2. To ensure that a given initial baudrate is correctly loaded, it is
important to permit the gateware to see the `use_auto` register
with a value of `0`. This is achieved by moving the regiser write
to after the applet is reset.
If the gateware does not see the initial `0` value, then the
`bit_cyc` register's default value of `0` will remain, locking up
the UART gateware as mentioned above.
Setting a reset value for the `manual_cyc` register is not
appropriate, as this would trigger a rebuild every time the
requested baudrate is modified.
When referring to the UART gateware being "inoperable", I am referring
specifically to the following section of code:
```
self.sync += [
If(rx_start,
rx_timer.eq(self.bit_cyc >> 1),
).Elif(rx_timer == 0,
rx_timer.eq(self.bit_cyc - 1)
).Else(
rx_timer.eq(rx_timer - 1)
)
]
```
The `rx_start` event causes the sample point to be shifted to ~50% of
the bit-time, however this will be zero. As `rx_timer` is already zero
it will be re-loaded with `bit_cyc - 1`, which probably wraps to "all
1s".
On a 48 MHz Glasgow, this will cause an 8-bit word (10 bit-times) to
take approx 20.8ns * 2^32 * 10 = 894 seconds...
by
Attie Grande
4 years 2 months
applet.interface.i2c_initiator: convert to nmigen
by
attie
4 years 2 months
cli, device.hardware: prepend bitstream ID to prebuilt bitstreams.
This makes prebuilt bitstreams functionally identical to just-in-time
built bitstreams; there are no warnings any more for using a prebuilt
bitstream that exactly matches the build plan.
Because prebuilt bitstreams are intended for resource constrained
devices, i.e. they are often not easily rebuilt, loading a prebuilt
bitstream with a mismatched ID only produces a warning. (It can't
really be an error given that nMigen-produced RTLIL files embed
file paths from the host system.)
by
whitequark
4 years 2 months
cli: replace command run-prebuilt→{run,repl,script} --prebuilt[-at].
It makes no sense to disallow using prebuilt bitstreams with REPL or
script runner, so turn the command into an option.
Also, clean up CLI help text a bit.
by
whitequark
4 years 2 months
cli: rename commands run-repl→repl, run-script→script.
The extra "run-" in the front isn't really necessary (both "repl" and
"script" work pretty well as verbs). Also, since commit 2c7828f6,
applets have a `repl()` method as well as a `run()` one, so it would
be nice if they corresponded to the `repl` and `run` commands.
by
whitequark
4 years 2 months
Stuff all of the custom_repl infrastructure into a bonfire.
Custom REPLs are very nice. custom_repl is awful for several reasons:
1. It required the user to watch out for a warning and then
remember to switch to a different, inconsistent command, or
else experience strange breakage.
2. It lacked any way to provide arguments to the REPL runner,
which in turn was justifying the behavior in (1).
3. It involved some incredibly gross metaclass code.
4. It was completely unnecessary. All of the metaclass stuff has
been replaced by a pair of methods that's easier to understand
*and* provides more useful functionality (REPL arguments).
I don't know what I was thinking.
by
whitequark
4 years 2 months