Re: Weird error

Nicolas Pinault <[email protected]> Mon, 18 Jan 2016 12:07:50 +0100
Newsgroups gmane.comp.python.myhdl
Message-ID <[email protected]>
Le 16/01/2016 12:55, Merkourios Katsimpris a écrit :
> Hallo guys,
>
> I tried to run this code:
>
> def dff(q,d,clk,rst):
>
>         @always(clk.posedge,rst.posedge)
>         def logic():
>               if rst==1:
>                     q.next=0
>               else:
>                     q.next=d
>
>         return logic
>
>
> def param_reg(q,d,clk,rst,width=4,n=2):
>
>        signal_list=[Signal(intbv(0)[width+1:]) for i in range(n+1)]
>        instance_list=[dff(signal_list[i+1],signal_list[i],clk,rst) for i
> in range(n)]
>
>        @always_comb
>        def logic():
>             signal_list[0].next=d
>             q.next=signal_list[n+1]
>
>        return logic,instance_list
>
>
> but I get the following error:AlwaysCombError: signal (signal_list) used
> as inout in always_comb function argument
>
> when i change the code of param_reg to :
>
> def param_reg(q,d,clk,rst,width=4,n=2):
>
>        signal_list=[Signal(intbv(0)[width+1:]) for i in range(n+1)]
>        instance_list=[dff(signal_list[i+1],signal_list[i],clk,rst) for i
> in range(n)]
>
>        @always_comb
>        def logic():
>             signal_list[0].next=d
>        @always_comb
>        def logic2():
>             q.next=signal_list[n+1]
>
>        return logic,instance_list,logic2
>
> It works fine. Do you know whats the problem?
Looks like a bug. I reproduced it with latest version from github.
However, be careful that  "q.next=signal_list[n+1]" is not correct. It 
should be "q.next=signal_list[n]".

regards,
Nicolas
>
> Thanks
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> myhdl-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/myhdl-list
> .
>


-- 
*Nicolas PINAULT
R&D electronics engineer
*** [email protected] <mailto:[email protected]>

*AATON-Digital*
38000 Grenoble - France
Tel +33 4 7642 9550

http://www.aaton.com
http://www.transvideo.eu
French Technologies for Film and Digital Cinematography

Follow us on Twitter
@Aaton_Digital
@Transvideo_HD

Like us on Facebook
https://www.facebook.com/AatonDigital

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
myhdl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/myhdl-list