fpga: sim: Fix stream command and status models
This updates PkgChdrBfm to correct some errors when modeling stream command and stream status packets. - Fix behavior when CHDR_W = 512 - Fix assertions in read_ctrl() Original-commit: ccf5d1e0a06bf8d46d7bf6dc33a17e3228a1bff4
This commit is contained in:
@@ -324,7 +324,7 @@ package PkgChdrBfm;
|
|||||||
for (int i = 0; i < $bits(status); i += CHDR_W) begin
|
for (int i = 0; i < $bits(status); i += CHDR_W) begin
|
||||||
data.push_back( status[i +: CHDR_W] );
|
data.push_back( status[i +: CHDR_W] );
|
||||||
end
|
end
|
||||||
update_lengths();
|
update_lengths($bits(status)/8);
|
||||||
endfunction : write_stream_status
|
endfunction : write_stream_status
|
||||||
|
|
||||||
|
|
||||||
@@ -344,8 +344,8 @@ package PkgChdrBfm;
|
|||||||
end
|
end
|
||||||
|
|
||||||
header = this.header;
|
header = this.header;
|
||||||
for (int i = 0; i < $bits(status)/CHDR_W; i++) begin
|
for (int i = 0; i < $bits(status); i+= CHDR_W) begin
|
||||||
status[i*CHDR_W +: CHDR_W] = data[i];
|
status[i +: CHDR_W] = data[i/CHDR_W];
|
||||||
end
|
end
|
||||||
endfunction : read_stream_status
|
endfunction : read_stream_status
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ package PkgChdrBfm;
|
|||||||
for (int i = 0; i < $bits(command); i += CHDR_W) begin
|
for (int i = 0; i < $bits(command); i += CHDR_W) begin
|
||||||
data.push_back( command[i +: CHDR_W] );
|
data.push_back( command[i +: CHDR_W] );
|
||||||
end
|
end
|
||||||
update_lengths();
|
update_lengths($bits(command)/8);
|
||||||
endfunction : write_stream_cmd
|
endfunction : write_stream_cmd
|
||||||
|
|
||||||
|
|
||||||
@@ -381,8 +381,8 @@ package PkgChdrBfm;
|
|||||||
end
|
end
|
||||||
|
|
||||||
header = this.header;
|
header = this.header;
|
||||||
for (int i = 0; i < $bits(command)/CHDR_W; i++) begin
|
for (int i = 0; i < $bits(command); i += CHDR_W) begin
|
||||||
command[i*CHDR_W +: CHDR_W] = data[i];
|
command[i +: CHDR_W] = data[i/CHDR_W];
|
||||||
end
|
end
|
||||||
endfunction : read_stream_cmd
|
endfunction : read_stream_cmd
|
||||||
|
|
||||||
@@ -530,10 +530,10 @@ package PkgChdrBfm;
|
|||||||
// words.
|
// words.
|
||||||
ctrl_packet_size = 3 + ctrl_header.num_data; // header + op_word + data
|
ctrl_packet_size = 3 + ctrl_header.num_data; // header + op_word + data
|
||||||
if (ctrl_header.has_time) ctrl_packet_size += 2; // timestamp
|
if (ctrl_header.has_time) ctrl_packet_size += 2; // timestamp
|
||||||
assert(data32.size() < ctrl_packet_size) else begin
|
assert (data32.size() >= ctrl_packet_size) else begin
|
||||||
$error("ChdrPacket::read_ctrl: Not enough CHDR payload for control packet");
|
$error("ChdrPacket::read_ctrl: Not enough CHDR payload for control packet");
|
||||||
end
|
end
|
||||||
assert(data32.size() > ctrl_packet_size) else begin
|
assert (data32.size() <= ctrl_packet_size) else begin
|
||||||
$warning("ChdrPacket::read_ctrl: Excess CHDR payload for control packet");
|
$warning("ChdrPacket::read_ctrl: Excess CHDR payload for control packet");
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -612,7 +612,7 @@ package PkgChdrBfm;
|
|||||||
|
|
||||||
// Returns 1 if the queues have the same contents, up to the
|
// Returns 1 if the queues have the same contents, up to the
|
||||||
// data_byte_length, if present.
|
// data_byte_length, if present.
|
||||||
function automatic bit ChdrPacket::chdr_word_queues_equal(
|
function bit ChdrPacket::chdr_word_queues_equal(
|
||||||
ref chdr_word_t a[$],
|
ref chdr_word_t a[$],
|
||||||
ref chdr_word_t b[$],
|
ref chdr_word_t b[$],
|
||||||
input int data_byte_length = -1
|
input int data_byte_length = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user