Skip to content

Commit

Permalink
more fixes to pack and unpack and bfifo
Browse files Browse the repository at this point in the history
  • Loading branch information
jjts committed Jan 14, 2024
1 parent 5d72beb commit 7438c3f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module iob_bfifo #(
end
end

//CONTROL LOGIC
//control logic
integer i;
always @* begin

Expand Down
13 changes: 9 additions & 4 deletions submodules/LIB/hardware/modules/iob_pack/hardware/src/iob_pack.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module iob_pack #(
);

//bfifo size
localparam BFIFO_REG_W = `IOB_MAX(UNPACKED_DATA_W, PACKED_DATA_W);
localparam BFIFO_REG_W = 2*`IOB_MAX(UNPACKED_DATA_W, PACKED_DATA_W);

//packed data width as a bit vector
localparam [$clog2(PACKED_DATA_W):0] PACKED_DATA_W_INT = {1'b1, {$clog2(PACKED_DATA_W){1'b0}}};
Expand Down Expand Up @@ -66,14 +66,19 @@ module iob_pack #(
data_read_nxt = data_read;

//prioritize push over pop
if (data_read && push_level >= len_i && rready_i) begin
if (data_read && push_level >= len_i) begin //push and read from external input fifo
push = 1'b1;
read = 1'b1; //read next unpacked word from external input fifo
if (rready_i) begin
read = 1'b1;
end else begin
data_read_nxt = 1'b0;
end
read = 1'b1;
end else if (wrap_i && push_level > 0 && push_level < len_i) begin //wrap up word by pushing zeros
push_len = push_level;
push_data = {UNPACKED_DATA_W{1'b0}};
push = 1'b1;
end else if (pop_level >= len_i && wready_i) begin //pop and write to external output fifo
end else if (pop_level >= PACKED_DATA_W_INT && wready_i) begin //pop and write to external output fifo
pop = 1'b1;
write = 1'b1;
end else if (!data_read && rready_i) begin //read new data from external input fifo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module iob_unpack #(
);

//bfifo size
localparam BFIFO_REG_W = `IOB_MAX(PACKED_DATA_W, UNPACKED_DATA_W);
localparam BFIFO_REG_W = 2*`IOB_MAX(PACKED_DATA_W, UNPACKED_DATA_W);

//packed data width as a bit vector
localparam [$clog2(PACKED_DATA_W):0] PACKED_DATA_W_INT = {1'b1, {$clog2(PACKED_DATA_W){1'b0}}};
Expand Down Expand Up @@ -73,9 +73,13 @@ module iob_unpack #(
pop_len = pop_level;
pop = 1'b1;
//no write
end else if (data_read && push_level >= PACKED_DATA_W_INT && rready_i) begin //push and read from external input fifo
push = 1'b1;
read = 1'b1;
end else if (data_read && push_level >= PACKED_DATA_W_INT) begin //push and read from external input fifo
push = 1'b1;
if (rready_i) begin
read = 1'b1;
end else begin
data_read_nxt = 1'b0;
end
end else if (!data_read && rready_i) begin //read new data from external input fifo
read = 1'b1;
data_read_nxt = 1'b1;
Expand Down

0 comments on commit 7438c3f

Please sign in to comment.