Re: [myhdl-list] combining values in signals
Brought to you by:
jandecaluwe
From: Josy B. <jos...@gm...> - 2015-03-03 17:02:29
|
Edward Vidal <develone <at> sbcglobal.net> writes: > > > Hello All,I am creating a 160 bit signals which works okay when the values are positive. > 2130 36 0 0x390e5390e2388e238ce2388e4390df37cdf38ce2L 0x390e538ce5388e238ce0388e4390e3380e1390e2L 0x38ce4394e4388e2388e3388e2390e437cdf37ce2L > W0 is set to 10 each value should take 10 bits. lft_s_i.next = (r[row+31][col] << W0*15) + (r[row+29][col] << W0*14) + (r[row+27][col] << W0*13) +(r[row+25][col] << W0*12) + (r[row+23][col] << W0*11) + (r[row+21][col] << W0*10) + (r[row+19][col] << W0*9) + (r[row+17][col] << W0*8) + (r[row+15][col] << W0*7) + (r[row+13][col] << W0*6) + (r[row+11][col] << W0*5) + (r[row+9][col] << W0*4) + (r[row+7] [col] << W0*3) + (r[row+5][col] << W0*2) + (r[row+3][col] << W0*1) + (r[row-1][col] ) <snip> ConcatSignal( *args ) should do the work. Make a list with all the required signals in it and hand that over. Make sure that the most left element is first in the list, else reverse the list. Note that the result of ConcatSignal() is a Signal in itself. So you don't do this inside an always_comb (or similar). I think you can do it like this: lft_s_i = ConcatSignal( *reversed( [ r[row - 1 + i * 2][col] for i in range(16)] )) I assume that r is defined as [[Signal(intbv(0)[10:] for _ in range(ncol)] for __ in range[nrow)] Regards, Josy |