Skip to content
Snippets Groups Projects
Commit 1ba87935 authored by dam1n19's avatar dam1n19
Browse files

ATO2-24: Added ID pass through to messae builder

parent e9d459e1
No related branches found
No related tags found
No related merge requests found
...@@ -25,24 +25,28 @@ module sha256_message_build ( ...@@ -25,24 +25,28 @@ module sha256_message_build (
// Config data and Handshaking // Config data and Handshaking
input logic [63:0] cfg_size, input logic [63:0] cfg_size,
input logic [1:0] cfg_scheme, input logic [1:0] cfg_scheme,
input logic [5:0] cfg_id,
input logic cfg_last, input logic cfg_last,
input logic cfg_valid, input logic cfg_valid,
output logic cfg_ready, output logic cfg_ready,
// Data Out data and Handshaking // Data Out data and Handshaking
output logic [511:0] data_out, output logic [511:0] data_out,
output logic [5:0] data_out_id,
output logic data_out_last, output logic data_out_last,
output logic data_out_valid, output logic data_out_valid,
input logic data_out_ready input logic data_out_ready
); );
logic [8:0] data_word_rem, next_data_word_rem; // Remainder number of bits after 512 division logic [8:0] data_word_rem, next_data_word_rem; // Remainder number of bits after 512 division
logic [63:0] cfg_size_reg, next_cfg_size; logic [63:0] reg_cfg_size, next_cfg_size;
logic [5:0] reg_cfg_id, next_cfg_id;
logic [2:0] state, next_state; // State Machine State logic [2:0] state, next_state; // State Machine State
logic [54:0] data_word_count, next_data_word_count; logic [54:0] data_word_count, next_data_word_count;
logic next_data_in_ready, next_cfg_ready, next_data_out_valid, next_data_out_last; logic next_data_in_ready, next_cfg_ready, next_data_out_valid, next_data_out_last;
logic [511:0] next_data_out; logic [511:0] next_data_out;
logic [5:0] next_data_out_id;
logic [511:0] last_word_mask; logic [511:0] last_word_mask;
logic [511:0] end_marker; logic [511:0] end_marker;
...@@ -72,22 +76,26 @@ module sha256_message_build ( ...@@ -72,22 +76,26 @@ module sha256_message_build (
state <= 3'd0; state <= 3'd0;
data_in_ready <= 1'b0; data_in_ready <= 1'b0;
cfg_ready <= 1'b1; cfg_ready <= 1'b1;
cfg_size_reg <= 64'd0; reg_cfg_size <= 64'd0;
reg_cfg_id <= 6'd0;
data_word_rem <= 9'd0; data_word_rem <= 9'd0;
data_out_valid <= 1'b0; data_out_valid <= 1'b0;
data_out_last <= 1'b0; data_out_last <= 1'b0;
data_out <= 512'd0; data_out <= 512'd0;
data_out_id <= 6'd0;
data_word_count <= 55'd0; data_word_count <= 55'd0;
extra_word <= 1'b0; extra_word <= 1'b0;
end else if (en == 1'b1) begin end else if (en == 1'b1) begin
state <= next_state; state <= next_state;
data_in_ready <= next_data_in_ready; data_in_ready <= next_data_in_ready;
cfg_ready <= next_cfg_ready; cfg_ready <= next_cfg_ready;
cfg_size_reg <= next_cfg_size; reg_cfg_size <= next_cfg_size;
reg_cfg_id <= next_cfg_id;
data_word_rem <= next_data_word_rem; data_word_rem <= next_data_word_rem;
data_out_valid <= next_data_out_valid; data_out_valid <= next_data_out_valid;
data_out_last <= next_data_out_last; data_out_last <= next_data_out_last;
data_out <= next_data_out; data_out <= next_data_out;
data_out_id <= next_data_out_id;
data_word_count <= next_data_word_count; data_word_count <= next_data_word_count;
extra_word <= next_extra_word; extra_word <= next_extra_word;
end else begin end else begin
...@@ -101,11 +109,13 @@ module sha256_message_build ( ...@@ -101,11 +109,13 @@ module sha256_message_build (
next_state = state; next_state = state;
next_data_in_ready = data_in_ready; next_data_in_ready = data_in_ready;
next_cfg_ready = cfg_ready; next_cfg_ready = cfg_ready;
next_cfg_size = cfg_size_reg; next_cfg_size = reg_cfg_size;
next_cfg_id = reg_cfg_id;
next_data_word_rem = data_word_rem; next_data_word_rem = data_word_rem;
next_data_out_valid = data_out_valid; next_data_out_valid = data_out_valid;
next_data_out_last = data_out_last; next_data_out_last = data_out_last;
next_data_out = data_out; next_data_out = data_out;
next_data_out_id = data_out_id;
next_data_word_count = data_word_count; next_data_word_count = data_word_count;
next_extra_word = extra_word; next_extra_word = extra_word;
...@@ -122,7 +132,7 @@ module sha256_message_build ( ...@@ -122,7 +132,7 @@ module sha256_message_build (
next_data_out_valid = 1'b0; next_data_out_valid = 1'b0;
end end
// If there is no Valid data at the output or there is a valid transfer happening on this clock cycle // If there is no Valid data at the output or there is a valid transfer happening on this clock cycle
if (cfg_valid == 1'b1) begin if ((cfg_valid == 1'b1) && (cfg_ready == 1'b1)) begin
// Check for already existing valid data at output // Check for already existing valid data at output
if (data_out_valid && !data_out_ready) begin if (data_out_valid && !data_out_ready) begin
next_data_in_ready = 1'b0; next_data_in_ready = 1'b0;
...@@ -130,6 +140,7 @@ module sha256_message_build ( ...@@ -130,6 +140,7 @@ module sha256_message_build (
next_data_in_ready = 1'b1; next_data_in_ready = 1'b1;
end end
// Handshake to Acknowledge Config Has been Read // Handshake to Acknowledge Config Has been Read
next_cfg_id = cfg_id;
next_cfg_size = cfg_size; next_cfg_size = cfg_size;
next_cfg_ready = 1'b0; next_cfg_ready = 1'b0;
next_data_word_count = word_extract + {53'd0, |rem_extract}; // Divide by 512 and round up next_data_word_count = word_extract + {53'd0, |rem_extract}; // Divide by 512 and round up
...@@ -161,6 +172,7 @@ module sha256_message_build ( ...@@ -161,6 +172,7 @@ module sha256_message_build (
next_data_in_ready = 1'b0; next_data_in_ready = 1'b0;
next_data_word_count = data_word_count - 1; next_data_word_count = data_word_count - 1;
// Write Input Data to Output // Write Input Data to Output
next_data_out_id = reg_cfg_id;
next_data_out = data_in; next_data_out = data_in;
next_data_out_valid = 1'b1; next_data_out_valid = 1'b1;
next_data_out_last = 1'b0; next_data_out_last = 1'b0;
...@@ -187,6 +199,7 @@ module sha256_message_build ( ...@@ -187,6 +199,7 @@ module sha256_message_build (
// Valid Handshake and data can be processed // Valid Handshake and data can be processed
if ((data_word_rem - 1) > 9'd446) begin if ((data_word_rem - 1) > 9'd446) begin
// If can't fit size in last word // If can't fit size in last word
next_data_out_id = reg_cfg_id;
next_data_out = last_data_word; next_data_out = last_data_word;
next_data_out_valid = 1'b1; next_data_out_valid = 1'b1;
next_data_out_last = 1'b0; next_data_out_last = 1'b0;
...@@ -195,7 +208,8 @@ module sha256_message_build ( ...@@ -195,7 +208,8 @@ module sha256_message_build (
next_data_in_ready = 1'b0; next_data_in_ready = 1'b0;
end else begin end else begin
// Size can fit in last data word // Size can fit in last data word
next_data_out = last_data_word | {448'd0, cfg_size_reg}; next_data_out_id = reg_cfg_id;
next_data_out = last_data_word | {448'd0, reg_cfg_size};
next_data_out_valid = 1'b1; next_data_out_valid = 1'b1;
next_data_out_last = 1'b1; next_data_out_last = 1'b1;
next_data_word_count = data_word_count - 1; next_data_word_count = data_word_count - 1;
...@@ -218,7 +232,8 @@ module sha256_message_build ( ...@@ -218,7 +232,8 @@ module sha256_message_build (
// If there is no Valid data at the output or there is a valid transfer happening on this clock cycle // If there is no Valid data at the output or there is a valid transfer happening on this clock cycle
end else begin end else begin
// Size can fit in last data word // Size can fit in last data word
next_data_out = {~|data_word_rem, 447'd0, cfg_size_reg}; next_data_out_id = reg_cfg_id;
next_data_out = {~|data_word_rem, 447'd0, reg_cfg_size};
next_data_out_valid = 1'b1; next_data_out_valid = 1'b1;
next_data_out_last = 1'b1; next_data_out_last = 1'b1;
// NEXT STATE: Read Next Config // NEXT STATE: Read Next Config
......
...@@ -26,12 +26,14 @@ module tb_sha256_message_build; ...@@ -26,12 +26,14 @@ module tb_sha256_message_build;
// Config data and Handshaking // Config data and Handshaking
logic [63:0] cfg_size; logic [63:0] cfg_size;
logic [1:0] cfg_scheme; logic [1:0] cfg_scheme;
logic [5:0] cfg_id;
logic cfg_last; logic cfg_last;
logic cfg_valid; logic cfg_valid;
logic cfg_ready; logic cfg_ready;
// Data Out data and Handshaking // Data Out data and Handshaking
logic [511:0] data_out; logic [511:0] data_out;
logic [5:0] data_out_id;
logic data_out_valid; logic data_out_valid;
logic data_out_ready; logic data_out_ready;
logic data_out_last; logic data_out_last;
...@@ -47,10 +49,12 @@ module tb_sha256_message_build; ...@@ -47,10 +49,12 @@ module tb_sha256_message_build;
.data_in_last (data_in_last), .data_in_last (data_in_last),
.cfg_size (cfg_size), .cfg_size (cfg_size),
.cfg_scheme (cfg_scheme), .cfg_scheme (cfg_scheme),
.cfg_id (cfg_id),
.cfg_last (cfg_last), .cfg_last (cfg_last),
.cfg_valid (cfg_valid), .cfg_valid (cfg_valid),
.cfg_ready (cfg_ready), .cfg_ready (cfg_ready),
.data_out (data_out), .data_out (data_out),
.data_out_id (data_out_id),
.data_out_last (data_out_last), .data_out_last (data_out_last),
.data_out_valid (data_out_valid), .data_out_valid (data_out_valid),
.data_out_ready (data_out_ready)); .data_out_ready (data_out_ready));
...@@ -66,11 +70,13 @@ module tb_sha256_message_build; ...@@ -66,11 +70,13 @@ module tb_sha256_message_build;
logic [63:0] cfg_size_queue [$]; logic [63:0] cfg_size_queue [$];
logic [1:0] cfg_scheme_queue [$]; logic [1:0] cfg_scheme_queue [$];
logic [5:0] cfg_id_queue [$];
logic cfg_last_queue [$]; logic cfg_last_queue [$];
int cfg_gap_queue [$]; int cfg_gap_queue [$];
logic cfg_wait_queue; logic cfg_wait_queue;
logic [511:0] data_out_queue [$]; logic [511:0] data_out_queue [$];
logic [5:0] data_out_id_queue [$];
logic data_out_last_queue [$]; logic data_out_last_queue [$];
int data_out_stall_queue [$]; int data_out_stall_queue [$];
logic data_out_wait_queue; logic data_out_wait_queue;
...@@ -117,6 +123,7 @@ module tb_sha256_message_build; ...@@ -117,6 +123,7 @@ module tb_sha256_message_build;
if (!nrst) begin if (!nrst) begin
cfg_size <= 64'd0; cfg_size <= 64'd0;
cfg_scheme <= 2'd0; cfg_scheme <= 2'd0;
cfg_id <= 6'd0;
cfg_valid <= 1'b0; cfg_valid <= 1'b0;
cfg_last <= 1'b0; cfg_last <= 1'b0;
cfg_gap <= 0; cfg_gap <= 0;
...@@ -131,9 +138,10 @@ module tb_sha256_message_build; ...@@ -131,9 +138,10 @@ module tb_sha256_message_build;
if (((cfg_valid == 1'b1) && (cfg_ready == 1'b1)) || if (((cfg_valid == 1'b1) && (cfg_ready == 1'b1)) ||
(cfg_wait_queue == 1'b1)) begin (cfg_wait_queue == 1'b1)) begin
// cfg transfer just completed or transfers already up to date // cfg transfer just completed or transfers already up to date
if ((cfg_size_queue.size() > 0) && (cfg_scheme_queue.size() > 0 ) && (cfg_last_queue.size() > 0) && (cfg_gap_queue.size() > 0)) begin if ((cfg_size_queue.size() > 0) && (cfg_scheme_queue.size() > 0) && (cfg_id_queue.size() > 0) && (cfg_last_queue.size() > 0) && (cfg_gap_queue.size() > 0)) begin
cfg_size <= cfg_size_queue.pop_front(); cfg_size <= cfg_size_queue.pop_front();
cfg_scheme <= cfg_scheme_queue.pop_front(); cfg_scheme <= cfg_scheme_queue.pop_front();
cfg_id <= cfg_id_queue.pop_front();
cfg_last <= cfg_last_queue.pop_front(); cfg_last <= cfg_last_queue.pop_front();
if (cfg_gap_queue[0] == 0) begin if (cfg_gap_queue[0] == 0) begin
cfg_valid <= 1'b1; cfg_valid <= 1'b1;
...@@ -152,9 +160,12 @@ module tb_sha256_message_build; ...@@ -152,9 +160,12 @@ module tb_sha256_message_build;
end end
logic [511:0] data_out_check; logic [511:0] data_out_check;
logic [5:0] data_out_id_check;
logic data_out_last_check; logic data_out_last_check;
int data_in_gap; int data_in_gap;
int cfg_gap; int cfg_gap;
int data_out_stall; int data_out_stall;
int packet_num; int packet_num;
...@@ -192,18 +203,29 @@ module tb_sha256_message_build; ...@@ -192,18 +203,29 @@ module tb_sha256_message_build;
always @(posedge clk) begin always @(posedge clk) begin
// Check Data on Handshake // Check Data on Handshake
if ((data_out_valid == 1'b1) && (data_out_ready == 1'b1)) begin if ((data_out_valid == 1'b1) && (data_out_ready == 1'b1)) begin
// Check Data Out Data
assert (data_out == data_out_check) else begin assert (data_out == data_out_check) else begin
$error("data_out missmatch! packet %d | recieve: %x != check: %x", packet_num, data_out, data_out_check); $error("data_out missmatch! packet %d | recieve: %x != check: %x", packet_num, data_out, data_out_check);
$finish; $finish;
end end
if ($test$plusargs ("DEBUG")) $display("data_out match! packet %d | recieve: %x == check: %x", packet_num, data_out, data_out_check); if ($test$plusargs ("DEBUG")) $display("data_out match! packet %d | recieve: %x == check: %x", packet_num, data_out, data_out_check);
// Check Data Out ID
assert (data_out_id == data_out_id_check) else begin
$error("data_out_id missmatch! packet %d | recieve: %d != check: %d", packet_num, data_out_id, data_out_id_check);
$finish;
end
if ($test$plusargs ("DEBUG")) $display("data_out_id match! packet %d | recieve: %d == check: %d", packet_num, data_out_id, data_out_id_check);
// Check Data Out Last
assert (data_out_last == data_out_last_check) else begin assert (data_out_last == data_out_last_check) else begin
$error("data_out_last missmatch! packet %d | recieve: %x != check: %x", packet_num, data_out_last, data_out_last_check); $error("data_out_last missmatch! packet %d | recieve: %x != check: %x", packet_num, data_out_last, data_out_last_check);
$finish; $finish;
end end
if ($test$plusargs ("DEBUG")) $display("data_out_last match! packet %d | recieve: %x == check: %x", packet_num, data_out_last, data_out_last_check); if ($test$plusargs ("DEBUG")) $display("data_out_last match! packet %d | recieve: %x == check: %x", packet_num, data_out_last, data_out_last_check);
if ((data_out_queue.size() > 0) && (data_out_last_queue.size() > 0)) begin if ((data_out_queue.size() > 0) && (data_out_id_queue.size() > 0) && (data_out_last_queue.size() > 0)) begin
data_out_check <= data_out_queue.pop_front(); data_out_check <= data_out_queue.pop_front();
data_out_id_check <= data_out_id_queue.pop_front();
data_out_last_check <= data_out_last_queue.pop_front(); data_out_last_check <= data_out_last_queue.pop_front();
if (data_out_last_check == 1'b1) begin if (data_out_last_check == 1'b1) begin
packet_num <= packet_num + 1; packet_num <= packet_num + 1;
...@@ -218,18 +240,20 @@ module tb_sha256_message_build; ...@@ -218,18 +240,20 @@ module tb_sha256_message_build;
// File Reading Variables // File Reading Variables
int fd; // File descriptor Handle int fd; // File descriptor Handle
logic [511:0] input_data; // Temporary Input Data Storage logic [511:0] temp_data_in; // Temporary Input Data Storage
logic input_data_last; // Temporary Input Data Last logic temp_data_in_last; // Temporary Input Data Last
int input_data_gap; // Temporary Input Gap int temp_data_in_gap; // Temporary Input Gap
logic [63:0] input_cfg_size; // Temporary cfg size logic [63:0] temp_cfg_in_size; // Temporary cfg size
logic [1:0] input_cfg_scheme; // Temporary cfg scheme logic [1:0] temp_cfg_in_scheme; // Temporary cfg scheme
logic input_cfg_last; // Temporary cfg last; logic [5:0] temp_cfg_in_id; // Temporary cfg ID
int input_cfg_gap; // Temporary cfg gap; logic temp_cfg_in_last; // Temporary cfg last;
int temp_cfg_in_gap; // Temporary cfg gap;
logic [511:0] output_data; // Temporary Output Data Storage logic [511:0] temp_data_out; // Temporary Output Data Storage
logic output_data_last; // Temporary Output Data Last logic [5:0] temp_data_out_id; // Temporary Output Data ID
int output_data_stall; // Temporary Output Stall logic temp_data_out_last; // Temporary Output Data Last
int temp_data_out_stall; // Temporary Output Stall
initial begin initial begin
$dumpfile("sha256_message_build.vcd"); $dumpfile("sha256_message_build.vcd");
...@@ -240,34 +264,37 @@ module tb_sha256_message_build; ...@@ -240,34 +264,37 @@ module tb_sha256_message_build;
// Read input data into Queue // Read input data into Queue
fd = $fopen("../stimulus/testbench/input_data_stim.csv", "r"); fd = $fopen("../stimulus/testbench/input_data_stim.csv", "r");
while ($fscanf (fd, "%x,%b,%d", input_data, input_data_last, input_data_gap) == 3) begin while ($fscanf (fd, "%x,%b,%d", temp_data_in, temp_data_in_last, temp_data_in_gap) == 3) begin
data_in_queue.push_back(input_data); data_in_queue.push_back(temp_data_in);
data_in_last_queue.push_back(input_data_last); data_in_last_queue.push_back(temp_data_in_last);
data_in_gap_queue.push_back(input_data_gap); data_in_gap_queue.push_back(temp_data_in_gap);
end end
$fclose(fd); $fclose(fd);
// Read input cfg into Queue // Read input cfg into Queue
fd = $fopen("../stimulus/testbench/input_cfg_stim.csv", "r"); fd = $fopen("../stimulus/testbench/input_cfg_sync_stim.csv", "r");
while ($fscanf (fd, "%x,%x,%b,%d", input_cfg_size, input_cfg_scheme, input_cfg_last, input_cfg_gap) == 4) begin while ($fscanf (fd, "%x,%x,%d,%b,%d", temp_cfg_in_size, temp_cfg_in_scheme, temp_cfg_in_id, temp_cfg_in_last, temp_cfg_in_gap) == 5) begin
cfg_size_queue.push_back(input_cfg_size); cfg_size_queue.push_back(temp_cfg_in_size);
cfg_scheme_queue.push_back(input_cfg_scheme); cfg_scheme_queue.push_back(temp_cfg_in_scheme);
cfg_last_queue.push_back(input_cfg_last); cfg_id_queue.push_back(temp_cfg_in_id);
cfg_gap_queue.push_back(input_cfg_gap); cfg_last_queue.push_back(temp_cfg_in_last);
cfg_gap_queue.push_back(temp_cfg_in_gap);
end end
$fclose(fd); $fclose(fd);
// Read output data into Queue // Read output data into Queue
fd = $fopen("../stimulus/testbench/output_message_block_ref.csv", "r"); fd = $fopen("../stimulus/testbench/output_message_block_ref.csv", "r");
while ($fscanf (fd, "%x,%b,%d", output_data, output_data_last, output_data_stall) == 3) begin while ($fscanf (fd, "%x,%d,%b,%d", temp_data_out, temp_data_out_id, temp_data_out_last, temp_data_out_stall) == 4) begin
data_out_queue.push_back(output_data); data_out_queue.push_back(temp_data_out);
data_out_last_queue.push_back(output_data_last); data_out_id_queue.push_back(temp_data_out_id);
data_out_stall_queue.push_back(output_data_stall); data_out_last_queue.push_back(temp_data_out_last);
data_out_stall_queue.push_back(temp_data_out_stall);
end end
$fclose(fd); $fclose(fd);
// Initialise First Checking Values // Initialise First Checking Values
data_out_check = data_out_queue.pop_front(); data_out_check = data_out_queue.pop_front();
data_out_id_check = data_out_id_queue.pop_front();
data_out_last_check = data_out_last_queue.pop_front(); data_out_last_check = data_out_last_queue.pop_front();
data_out_stall = data_out_stall_queue.pop_front(); data_out_stall = data_out_stall_queue.pop_front();
......
...@@ -41,6 +41,7 @@ def main(): ...@@ -41,6 +41,7 @@ def main():
in_data_words_last_list = [] in_data_words_last_list = []
in_data_words_gap_list = [] in_data_words_gap_list = []
message_block_list = [] message_block_list = []
message_block_id_list = []
message_block_last_list = [] message_block_last_list = []
message_block_gap_list = [] message_block_gap_list = []
message_block_stall_list = [] message_block_stall_list = []
...@@ -87,6 +88,7 @@ def main(): ...@@ -87,6 +88,7 @@ def main():
expected_id_list.append(id_value) expected_id_list.append(id_value)
sync_cfg_id_list.append(id_value) sync_cfg_id_list.append(id_value)
old_id_value = id_value
# Reference Values # Reference Values
...@@ -103,6 +105,7 @@ def main(): ...@@ -103,6 +105,7 @@ def main():
in_data_words_last = [] in_data_words_last = []
in_data_words_gap = [] in_data_words_gap = []
message_block = chunked_data_words.copy() message_block = chunked_data_words.copy()
message_block_id = []
message_block_last = [] message_block_last = []
message_block_stall = [] message_block_stall = []
message_block_gap = [] message_block_gap = []
...@@ -130,6 +133,7 @@ def main(): ...@@ -130,6 +133,7 @@ def main():
for i in range(len(message_block)): for i in range(len(message_block)):
message_block_last.append("0") message_block_last.append("0")
message_block_id.append(old_id_value)
if stall_limit > 0: if stall_limit > 0:
message_block_stall.append(random.randrange(0,stall_limit)) message_block_stall.append(random.randrange(0,stall_limit))
else: else:
...@@ -146,6 +150,7 @@ def main(): ...@@ -146,6 +150,7 @@ def main():
in_data_words_last_list += in_data_words_last in_data_words_last_list += in_data_words_last
in_data_words_gap_list += in_data_words_gap in_data_words_gap_list += in_data_words_gap
message_block_list += message_block message_block_list += message_block
message_block_id_list += message_block_id
message_block_last_list += message_block_last message_block_last_list += message_block_last
message_block_gap_list += message_block_gap message_block_gap_list += message_block_gap
message_block_stall_list += message_block_stall message_block_stall_list += message_block_stall
...@@ -183,6 +188,13 @@ def main(): ...@@ -183,6 +188,13 @@ def main():
for idx, word in enumerate(in_cfg_words_list): for idx, word in enumerate(in_cfg_words_list):
writer.writerow(["{0:x}".format(int(word, 2)), "0", "1", in_cfg_words_gap_list[idx]]) writer.writerow(["{0:x}".format(int(word, 2)), "0", "1", in_cfg_words_gap_list[idx]])
# Write out Cfg Stimulus to Text File
input_header = ["input_cfg_size", "input_cfg_scheme", "input_cfg_id", "input_cfg_last"]
with open(os.environ["SHA_2_ACC_DIR"] + "/simulate/stimulus/testbench/" + "input_cfg_sync_stim.csv", "w", encoding="UTF8", newline='') as f:
writer = csv.writer(f)
for idx, word in enumerate(in_cfg_words_list):
writer.writerow(["{0:x}".format(int(word, 2)), "0", expected_id_list[idx] ,"1", in_cfg_words_gap_list[idx]])
# Write out Cfg sync reference to Text File # Write out Cfg sync reference to Text File
input_header = ["input_cfg_size", "input_cfg_scheme", "input_cfg_last"] input_header = ["input_cfg_size", "input_cfg_scheme", "input_cfg_last"]
with open(os.environ["SHA_2_ACC_DIR"] + "/simulate/stimulus/testbench/" + "output_cfg_sync_ref.csv", "w", encoding="UTF8", newline='') as f: with open(os.environ["SHA_2_ACC_DIR"] + "/simulate/stimulus/testbench/" + "output_cfg_sync_ref.csv", "w", encoding="UTF8", newline='') as f:
...@@ -191,11 +203,11 @@ def main(): ...@@ -191,11 +203,11 @@ def main():
writer.writerow(["{0:x}".format(int(word, 2)), "0", sync_cfg_id_list[idx], "1", sync_cfg_stall_list[idx]]) writer.writerow(["{0:x}".format(int(word, 2)), "0", sync_cfg_id_list[idx], "1", sync_cfg_stall_list[idx]])
# Write out Expected output to text file # Write out Expected output to text file
output_header = ["output_data", "output_data_last"] output_header = ["output_data", "output_data_id", "output_data_last"]
with open(os.environ["SHA_2_ACC_DIR"] + "/simulate/stimulus/testbench/" + "output_message_block_ref.csv", "w", encoding="UTF8", newline='') as f: with open(os.environ["SHA_2_ACC_DIR"] + "/simulate/stimulus/testbench/" + "output_message_block_ref.csv", "w", encoding="UTF8", newline='') as f:
writer = csv.writer(f) writer = csv.writer(f)
for idx, word in enumerate(message_block_list): for idx, word in enumerate(message_block_list):
writer.writerow(["{0:x}".format(int(word, 2)), message_block_last_list[idx], message_block_stall_list[idx]]) writer.writerow(["{0:x}".format(int(word, 2)), message_block_id_list[idx] ,message_block_last_list[idx], message_block_stall_list[idx]])
# Write out Message Block (Input) to text file # Write out Message Block (Input) to text file
output_header = ["message_block_data", "message_block_data_last"] output_header = ["message_block_data", "message_block_data_last"]
......
718,0,0,1,2
3d08,0,1,1,1
3800,0,2,1,0
dc0,0,3,1,0
640,0,4,1,2
1278,0,5,1,2
1dc0,0,6,1,1
c80,0,7,1,1
a50,0,8,1,2
1c8,0,9,1,0
1258,0,10,1,1
458,0,11,1,2
20b0,0,12,1,2
3a8,0,13,1,1
1968,0,14,1,2
1228,0,15,1,1
1910,0,16,1,2
1c80,0,17,1,1
1858,0,18,1,1
21f8,0,19,1,0
258,0,20,1,1
2a20,0,21,1,2
2328,0,22,1,1
9f8,0,23,1,1
3e08,0,24,1,2
38,0,25,1,2
3508,0,26,1,1
1930,0,27,1,2
1c80,0,28,1,1
678,0,29,1,0
3a48,0,30,1,1
e98,0,31,1,2
29a8,0,32,1,2
1c90,0,33,1,0
3138,0,34,1,2
1a70,0,35,1,1
1be8,0,36,1,2
1858,0,37,1,0
5f8,0,38,1,1
1108,0,39,1,1
11e8,0,40,1,2
23f8,0,41,1,2
928,0,42,1,1
3500,0,43,1,0
30c0,0,44,1,0
3650,0,45,1,1
3318,0,46,1,2
14b0,0,47,1,1
1930,0,48,1,0
1730,0,49,1,0
2278,0,50,1,2
18,0,51,1,1
30c8,0,52,1,1
2238,0,53,1,0
420,0,54,1,2
1a10,0,55,1,2
2a0,0,56,1,2
768,0,57,1,0
2e28,0,58,1,0
2c30,0,59,1,0
22f8,0,60,1,2
2178,0,61,1,1
11c0,0,62,1,1
1d30,0,63,1,0
c40,0,0,1,2
2308,0,1,1,0
2690,0,2,1,1
3ca8,0,3,1,2
24a0,0,4,1,0
3ab8,0,5,1,2
2980,0,6,1,1
2730,0,7,1,1
3858,0,8,1,0
950,0,9,1,2
2938,0,10,1,1
1eb0,0,11,1,1
3af0,0,12,1,1
1e20,0,13,1,0
21e8,0,14,1,2
b60,0,15,1,1
df8,0,16,1,1
a60,0,17,1,2
1470,0,18,1,1
1ae0,0,19,1,1
10d8,0,20,1,0
3b8,0,21,1,1
d68,0,22,1,0
27c0,0,23,1,0
3be0,0,24,1,1
900,0,25,1,0
3b50,0,26,1,2
10d8,0,27,1,2
3ca0,0,28,1,0
3b28,0,29,1,2
1fc8,0,30,1,1
3c18,0,31,1,2
2490,0,32,1,2
26d8,0,33,1,1
3658,0,34,1,1
c90,0,35,1,0
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment