-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
else
branch elided in generated Verilog
#274
Comments
Blocking vs. nonblocking has nothing to do with sequential vs. combinatorial. |
Please provide a complete self-contained minimal piece of code that demonstrates the bug. I suspect the problem is somewhere else in your codebase. |
I can't readily produce it out of context, although this module on its own is simple—it contains only instantiations of an ARTIQ class USTransmitter(Module):
def __init__(
self,
refclk: Tuple[Signal, Signal],
txd0: Tuple[Signal, Signal],
txd1: Tuple[Signal, Signal],
txp: Tuple[Signal, Signal],
):
self.tready_o = Signal(reset_less=True)
self.tvalid_i = Signal.like(self.tready_o)
self.tid_i = Signal.like(self.tready_o)
self.tdata_i = Signal(8, reset_less=True)
self.error_o = Signal(3, reset_less=True)
(refclk_p, refclk_n) = refclk
(txd0_p, txd0_n) = txd0
(txd1_p, txd1_n) = txd1
(txp_p, txp_n) = txp
self.specials += [
Instance(
"phy_tx_upstream",
i_clk_i=ClockSignal(),
i_rst_ni=~ResetSignal(),
o_axis_tready_o=self.tready_o,
i_axis_tvalid_i=self.tvalid_i,
i_axis_tid_i=self.tid_i,
i_axis_tdata_i=self.tdata_i,
o_error_o=self.error_o,
i_clk_ui_i=ClockSignal("ui"),
o_refclk_po=refclk_p,
o_refclk_no=refclk_n,
o_txd0_po=txd0_p,
o_txd0_no=txd0_n,
o_txd1_po=txd1_p,
o_txd1_no=txd1_n,
o_txp_po=txp_p,
o_txp_no=txp_n,
),
] The generated Verilog becomes correct if the self.tx.tid_i.eq(1),
self.tx.tdata_i.eq(0b0010_0010),
If(self.rtlink.o.stb & self.rx.lock_o,
self.tx.tid_i.eq(self.rtlink.o.address != 0xDC),
self.tx.tdata_i.eq(self.rtlink.o.data),
), |
I have the following in a Migen module:
The important part is the
If
at the bottom. All the inputs toself.rx
andself.tx
are registered within those modules.When translated to Verilog, this module produces the following output:
This is wrong—the assignment
self.tx.tid_i.eq(1)
in the.Else()
has been elided, which produces different behaviour (self.tx.tid_i
now has the value'0
when there is no RTIO input instead of1'b1
). I'm also suspicious of the generated Verilog using the nonblocking assignment when it should be combinatorial.The text was updated successfully, but these errors were encountered: