Re: [myhdl-list] myhdl.AlwaysCombError: signal (startmpy) used as inout in always_comb function argu
Brought to you by:
jandecaluwe
From: Josy B. <jos...@gm...> - 2015-02-11 19:44:37
|
Christopher Felton <chris.felton <at> gmail.com> writes: > > Why have a single comb vs. two comb? Because they target the same outputs. I'll augment the simplified example a bit: def contrivedtwostatemachineexample( Clk, Reset, StartP, Status, ... ) states_first = enum( "IDLE" , "ONE" , "TWO") smfp, smfn = [Signal( states_first.IDLE ) for _ in range( 2 )] states_second = enum( "IDLE" , "BUSY") smfp, smfn = [Signal( states_second .IDLE ) for _ in range( 2 )] startsecond, donesecond = [Signal(bool(0)) _ for _ in range(2)} <at> always_comb def smcomb(): startsecond.next = 0 donesecond.next = 0 Status.next = 0 if smfp == states_first.IDLE: Status.next = 1 if StartP: smfn.next = states_first.ONE startsecond.next = 1 else: smfn.next = states_first.IDLE elif smfp == states_first.ONE: Status.next = 2 if donesecond: smfn.next = states_first.TWO startsecond.next = 1 else: smfn.next = states_first.ONE elif smfp == states_first.TWO: Status.next = 3 if donesecond: smfn.next = states_first.IDLE else: smfn.next = states_first.TWO if smsp == states_second.IDLE: Status.next = 10 if startsecond: smsn.next = states_second.BUSY else: smsn.next = states_second.IDLE elif smsp == states_second.BUSY: Status.next = 11 donesecond.next = 1 # must catch an immediate start command if startsecond: smsn.next = states_second.BUSY else: smsn.next = states_second.IDLE <at> always_seq(Clk.posedge, reset=Reset) def smprocess(): smfp.next = smfn smsp.next = smsn return smcomb, smprocess If we split it over two processes, VHDL will complain about multiple drivers ... > > def smcombfp(): > ... > > def smcombsn(): > ... > > I believe the inout comb detection is a mechanism to > protect against unwanted comb feedback. If you have > a complicated <at> always_comb it probably make sense to > split it out rather than remove the comb feedback > detection. What is **unwanted comb feedback**? Is this in the Verilog LRM? Or is the comb feedback in the code to protect us from ourselves? If it is not against Verilog, the **comb feedback detection** should, IMHO, be reworked. If Verilog has a problem with this ... you tell me. Splitting my actual code in two processes would add clumsy workarounds, making the code not any prettier. Regards, Josy |