keyboardcowboy
Member level 3
- Joined
- Mar 4, 2010
- Messages
- 55
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,715
I am trying to implement a sort of serial FIFO (couldn't think of a better name) wherein a 32bit data is pushed in, and variable bits can be taken out. I have implemented it in systemverilog in this way
now when i want to extract some bits from the end
The problem is that I have to implement the same thing in verilog as well, and I am unable to come up with any ideas
Code:
reg [1023:0] wk;
bitsleft=0;
if(pushin) begin // pushin is just a variable which is set to 1 when i want to insert data
for(ix=bitsleft; ix < bitsleft+32; ix=ix+1)
wk[ix]=datain[ix-bitsleft]; // datain is the 32bit that i am pushing in, random.
bitsleft += 32;
now when i want to extract some bits from the end
Code:
expdata=wk[14:0];
expdata &= ~(16'hffff << reqlen); //reqlen is the length of the bits to be extracted, random from 0 to 15
bitsleft -= reqlen;
wk = wk >> reqlen;
The problem is that I have to implement the same thing in verilog as well, and I am unable to come up with any ideas
Attachments
Last edited: