Академический Документы
Профессиональный Документы
Культура Документы
Q[31:0]
a[8:0]
d[8:0] clk
FIFO
rst_b
The first bit of 9 bits (i.e. 0th bit) of each of the inputs denotes the validity of the bit.
If first bit =
1 - Valid
0 - Invalid
When clock signal is obtained, if the first bit of the input is valid then the remaining 8 bits data will be
stored in data storing register otherwise the 8 bits data will be discarded .
Then at the application of next clock it will look for the next valid bit and the cycle repeats at every
positive edge of the clock signal. Thus at the time when the value of stored bits get 32 bits, it will
become the output [31:0] Q which will be given to the FIFO block as shown in the block diagram.
store is taken as a temporary register of 24 bits which will temporarily store the bits.
When RST_b = 0
Else
For all the possible combinations of the first bit of each input and previously stored bytes output will
be taken and each time status and pass is updated.
For instance
begin
if(status=='d0)
begin
store[7:0]<=b[8:1];
store[15:8]<=d[8:1];
status<='d2;
f<=1'b0;
end
else
if(status=='d1)
begin
store[15:8]<=b[8:1];
store[23:16]<=d[8:1];
status<='d3;
pass<=0;
end
else
if(status=='d2)
begin
Q[31:0]<={d[8:1],b[8:1],store[15:0]};
store[23:0]<='h000000;
status<='d0;
pass<=1;
end
else
if(status=='d3)
begin
Q[31:0]<={b[8:1],store[23:0]};
store[23:16]<='h00;
store[7:0]<=d[8:1];
status<='d1;
pass<=0;
end
end
In the above case, b[0] & d[0] represents the valid bit and rest are invalid. Now there are 4 cases
i) If status=0, it means already stored bytes are 0 i.e. nothing is stored in the temporary
stored register.
So,
Bits b [8:1] gets stored in register store [7:0] memory location,
Bits d [8:1] gets stored in register store [15:8] memory location,
Updated value of status becomes 2 &
Updated value of pass will be 0
ii) If status=1, it means already stored bytes are 1 i.e. 1 byte is already stored in the
temporary register at store [7:0] memory location.
So,
Bits b [8:1] gets stored in register store [15:8] memory location,
Bits d [8:1] gets stored in register store [23:16] memory location,
Updated value of status becomes 3 &
Updated value of pass will be 0
iii) If status=2, it means already stored bytes are 2 and there are 2 valid bits thus in this case
pass will be 1 and output of the block will be as follows:-
Q [7:0] = store [7:0]
Q [15:8] =store [15:8]
Q[23:16] =b [8:1]
Q[31:24] =d [8:1]
Updated value of status becomes 0 &
Updated value of pass will be 1
iv) If status=3, it means already stored bytes are 3 and there are 2 valid bits thus 4 of them
will be output and 1 will get stored in the temporary register at store [7:0] memory
location like this:-
Q[23:0] =store [23:0]
Q [31:24] =b [8:1]
store [7:0] =d [8:1]
Updated value of status becomes 1&
Updated value of pass will be 1