Re: [myhdl-list] TypeError: Unexpected type
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-03-26 11:37:22
|
On 3/26/15 2:25 AM, Guy Eschemann wrote: > Thanks Chris, that does the trick. This has been fixed in the master branch, if you get the latest your original code should work. https://github.com/jandecaluwe/myhdl/issues/40 https://github.com/jandecaluwe/myhdl/pull/41 Regards, Chris > > > You can work around it with: > > In [5]: from myhdl import * >   ...: >   ...: def mpegChannel(clk, rst): >   ...: >   ...:   s_tx_data_xor_mask_r = Signal(intbv(0)[1 + 31:]) > >   ...:   # *** limited range type for switch *** >   ...:   full_case = intbv(0, min=0, max=4) > >   ...:   @always_seq(clk.posedge, rst) >   ...:   def fsm_seq(): >   ...:     for i in range(4): >   ...:       full_case[:] = i >   ...:       if full_case == 0: >   ...:         s_tx_data_xor_mask_r.next[1 + > 7:0] = 0 >   ...:       elif full_case == 1: >   ...:         s_tx_data_xor_mask_r.next[1 + > 15:8] = 1 >   ...:       elif full_case == 2: >   ...:         s_tx_data_xor_mask_r.next[1 + > 23:16] = 2 >   ...:       else: >   ...:         s_tx_data_xor_mask_r.next[1 + > 31:24] = 3 >   ...: >   ...:   return instances() > > The limitation is, when evaluating an if-else structure > the conversion code wants to determine if it full-case > or not, because the variable switched on is an `int` it > throws the type error. But the code example seems reasonable, > I think? > > Regards, > Chris > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > > > > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > |