--- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote:
>
> Jesuraj vinoth wrote:
> > I am trying to convert code written in verilog to C. I need to 
convert 
> > the following line present in verilog to C.  
> > 
> >  data = { 8'b00000001, a, 1'b0, b, 16'h1234 }
> > 
> >  were data is 32-bit , a and b are 3 bit. The a and b are given 
> > different 3 bit values (i.e 0 to 7) down the code.
> > Can anyone help me on this?
> 
> Bitwise 'or'?
> 
> data = 0x01000000 | ((a & 0x07) << 4) | 0x00080000 | (b & 0x07) | 
> 0x00001234;
> 
> Or something like that.  Although, it appears to be missing a bit 
> (totals to 31 bits).
> 
> -- 
> Thomas Hruska
> CubicleSoft President
> Ph: 517-803-4197
> 
> *NEW* MyTaskFocus 1.1
> Get on task.  Stay on task.
> 
> http://www.CubicleSoft.com/MyTaskFocus/
>

Thanks Thomas.
The assignment i used was:
data = 0x01000000 | ((i & 0x00000007) << 20 ) | ((j & 0x00000007) 
<<16) | 0x00000050 ;

btw it was 32 bit data.

Reply via email to