Re: [myhdl-list] TypeError: Unexpected type
Brought to you by:
jandecaluwe
From: Guy E. <guy...@gm...> - 2015-03-26 07:25:36
|
Thanks Chris, that does the trick. > 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 > > |