Skip to content
Snippets Groups Projects
Commit 3b39d7f9 authored by dam1n19's avatar dam1n19
Browse files

changed format of generated values and read input data into testbench

parent 8ae53916
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ module tb_engine;
logic nrst;
// Data In data and Handshaking
logic [511:0] data_in;
logic data_in_last;
logic data_in_valid;
logic data_in_ready;
......@@ -37,6 +38,7 @@ module tb_engine;
.data_in(data_in),
.data_in_valid(data_in_valid),
.data_in_ready(data_in_ready),
.data_in_last(data_in_last),
.cfg_size(cfg_size),
.cfg_scheme(cfg_scheme),
.cfg_valid(cfg_valid),
......@@ -47,6 +49,7 @@ module tb_engine;
logic data_in_drive_en;
logic [511:0] data_in_queue [$];
logic data_in_last_queue [$];
logic data_in_wait_queue;
// Handle Valid and Data for data_in
......@@ -54,13 +57,15 @@ module tb_engine;
if (!nrst) begin
data_in <= 512'd0;
data_in_valid <= 1'b0;
data_in_last <= 1'b0;
data_in_wait_queue <= 1'b1;
end else if (data_in_drive_en) begin
if (((data_in_valid == 1'b1) && (data_in_ready == 1'b1)) ||
(data_in_wait_queue == 1'b1)) begin
// Data transfer just completed or transfers already up to date
if (data_in_queue.size() > 0) begin
data_in <= data_in_queue.pop_front();
if ((data_in_queue.size() > 0) && (data_in_last_queue.size() > 0)) begin
data_in <= data_in_queue.pop_front();
data_in_last <= data_in_last_queue.pop_front();
data_in_valid <= 1'b1;
data_in_wait_queue <= 1'b0;
end else begin
......@@ -72,28 +77,23 @@ module tb_engine;
end
end
logic [511:0] temp_data ;
int fd; // File descriptor handle
string str1,str2,str3,str4,str5;
logic [511:0] input_data;
logic input_data_last;
initial begin
$dumpfile("engine_sim.vcd");
$dumpvars(0, tb_engine);
fd = $fopen("input_builder_stim.csv", "r");
$fscanf(fd, "%s,%s,%s,%s,%s", str1, str2, str3, str4, str5);
$fclose(fd);
data_in_drive_en = 0;
for (int idx_1 = 0; idx_1 < 20; idx_1 = idx_1 + 1) begin
for (int idx = 1; idx < 5; idx = idx + 1) begin
data_in_queue.push_back({$urandom(),$urandom(),$urandom(),$urandom(),$urandom(),$urandom(),
$urandom(),$urandom(),$urandom(),$urandom(),$urandom(),$urandom(),
$urandom(),$urandom(),$urandom(),$urandom()});
end
// Read input data into Queue
fd = $fopen("input_data_builder_stim.csv", "r");
while ($fscanf (fd, "%x,%b", input_data, input_data_last) == 2) begin
data_in_queue.push_back(input_data);
data_in_last_queue.push_back(input_data_last);
end
$fclose(fd);
cfg_size = 0;
cfg_scheme = 0;
cfg_valid = 0;
......
......@@ -60,28 +60,22 @@ def main(argv):
input_header = ["input_data", "input_data_last"]
with open("input_data_builder_stim.csv", "w", encoding="UTF8", newline='') as f:
writer = csv.writer(f)
# Write Header Row
writer.writerow(input_header)
for idx, word in enumerate(in_data_words):
writer.writerow([word, in_data_words_last[idx]])
writer.writerow(["{0:x}".format(int(word, 2)), in_data_words_last[idx]])
# Ouptut Input Data Stimulus to Text File
input_header = ["input_cfg_size", "input_cfg_scheme", "input_cfg_last"]
with open("input_cfg_builder_stim.csv", "w", encoding="UTF8", newline='') as f:
writer = csv.writer(f)
# Write Header Row
writer.writerow(input_header)
for idx, word in enumerate(in_data_words):
writer.writerow([cfg_size_str, "00", "1"])
writer.writerow(["{0:x}".format(int(cfg_size_str, 2)), "00", "1"])
# Output Expected output to text file
output_header = ["output_data", "output_data_last"]
with open("output_data_builder_stim.csv", "w", encoding="UTF8", newline='') as f:
writer = csv.writer(f)
# Write Header Row
writer.writerow(output_header)
for idx, word in enumerate(out_data_words):
writer.writerow([word, out_data_words_last[idx]])
writer.writerow(["{0:x}".format(int(word, 2)), out_data_words_last[idx]])
def chunkstring(string, length):
array_len = math.ceil(len(string)/length)
......
input_cfg_size,input_cfg_scheme,input_cfg_last
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
1132,00,1
input_data,input_data_last
11001001010110001110101110000011100010000011111101000010101011100001110000100010000101001111010000010000110100100110001110100100000000011111000110001101110100001011000100001010110000010001010000011110100010101101010011110110000001000000001100111000001011111110010100001011000010110001000101011110101111001010111111110110010001001100011111011110011111011101100000101000010101100101010110001101001101011110001101001110101001011110110001011001111111010011110101010011111100001111110101011100111010111100011000111111,0
00001001101001111010111011111101111010011110100010010110001001010001101101001100010101010001011001010000110101111011010100001000001111011011101010110011101111111011011001011110111001100001000101010111101011000101111100110010100100001110011000011111000100100001101001110001101111010111100000010011110111100000010001101011010101111010101111101101001110001000101000100100010010110110010001101101000011001011001001011001011010010101111001000000101011010010001111100010111110000110111111011010010100101110110001010000,0
00110010011011111011111111101011000110001000101101110000111101010001001001100010011111001001101000001110001101000100101100110101110101110101000010100100010111110101010110001001101001101101010011000111100011101001100001001100111111101111101011010101110011001001001010100101011101001000000011110001101011100110101000111110100111000000011011000000111111001110000011111011001101100000011110011010001011001111101111001101100010111101011101110111110111010100100011111110010000000001101000110100010110110101101100001000,0
01010100111110111111110010010011100001111010011101011100010110011001100111010100011100101010001000110110111010100010101010010101110000010111101101011111000111110110111000000101000011110111100101010010011110000010010111110000000111101101100001101110000100101011101001011110110111001010000000110011111101101111111100001011101010011001100001010000100011101010001011001101000101111100101111000110110000111000110011001100110011110001111111010010001101101011001110101001111101100000101001000110010110100100011100111001,0
11100101001000111111010101001000010101000111100001101011001101011100000101001111001101010100010101100010010111010000001011000000001011001011101011110110100101111100010011101100101001010001011110010000010101010111100111100011001001010111101110111010110101000100100101001010011000010110011010111100010011010001110000000001000001000101010011010110101000101111100100011110100111011000110100001000111011111010110000111111111010010100000000011101110101011011011000011100110001101100010000011010010001010011111101110110,0
11000110100010100111100000110110100111111111011110111000000011001011001101010000011000011100000011110100010001111001110001100000011001000111111011000011100010010101110001011110000000111011011110011011110000111101110011101000101111001111000000110110000001111110101001111010111111000000100110000110001000010001101110111001100001110110111111010111110111101011001111111100101100001100101101001100111001111111000011001100010001010110110011111000001101100000101000100101000000010010110110100000100111111100010101001101,0
00000001000011110101001100100100010100111110111010000011010000011100111101011100100000101101101101110011011100011000001111101010010111110110111000101000101000011000100011001001111100110110000111111001100111001000110100010101110001111000111111111000111111101010000101010001010010111010101011101010011000001001110101001000000101001001100011100110101000100011111100011010110111000101101101101100011111110010001000010111000111101010000110111001000000100111001010010110110110010001000100001101001011000000000001000101,0
00000010110100110110001000110010001110001010110011100001100100100110010011000010110011011100000010000111001110110011011101100100111010010100001100110001111001010100000101000110111010101111101001011001110110010111001001011000001101100111001100000011101000001110001111010100001111100111001000010110010000010000110000000011100101110100011000011010110111111100110010010110111001001111010011100011000010110011000010010111001110110100101101010011011001110110011000001101101111000111001010001000001100001011100110001000,0
11101100010100011110000101100111001101111010001000111111011010100110101010111101100011110001011111110101110001001010000010100110000110100001111000001000000100111110001001101000111000011100001101011101111000100110011010110000100111110001100001101100011110001011010101101111110010001101101110101100001001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,1
c958eb83883f42ae1c2214f410d263a401f18dd0b10ac1141e8ad4f60403382fe50b0b115ebcaff644c7de7dd82856558d35e34ea5ec59fd3d53f0fd5cebc63f,0
9a7aefde9e896251b4c551650d7b5083dbab3bfb65ee61157ac5f3290e61f121a71bd7813de046b57abed388a244b646d0cb259695e40ad23e2f86fda52ec50,0
326fbfeb188b70f512627c9a0e344b35d750a45f5589a6d4c78e984cfefad5cc92a57480f1ae6a3e9c06c0fce0fb36079a2cfbcd8bd777dd48fe401a345b5b08,0
54fbfc9387a75c5999d472a236ea2a95c17b5f1f6e050f79527825f01ed86e12ba5edca033f6ff0ba998508ea2cd17cbc6c38ccccf1fd236b3a9f60a465a4739,0
e523f54854786b35c14f3545625d02c02cbaf697c4eca517905579e3257bbad4494a6166bc4d1c010454d6a2f91e9d8d08efac3fe9401dd5b61cc6c41a453f76,0
c68a78369ff7b80cb35061c0f4479c60647ec3895c5e03b79bc3dce8bcf03607ea7afc0986211bb9876fd7deb3fcb0cb4ce7f0cc456cf8360a25012da09fc54d,0
10f532453ee8341cf5c82db737183ea5f6e28a188c9f361f99c8d15c78ff8fea1514baaea609d481498e6a23f1adc5b6c7f22171ea1b9027296d9110d2c0045,0
2d3623238ace19264c2cdc0873b3764e94331e54146eafa59d97258367303a0e3d43e7216410c0397461adfcc96e4f4e30b30973b4b5367660dbc728830b988,0
ec51e16737a23f6a6abd8f17f5c4a0a61a1e0813e268e1c35de266b09f186c78b56fc8dbac250000000000000000000000000000000000000000000000000000,1
output_data,output_data_last
11001001010110001110101110000011100010000011111101000010101011100001110000100010000101001111010000010000110100100110001110100100000000011111000110001101110100001011000100001010110000010001010000011110100010101101010011110110000001000000001100111000001011111110010100001011000010110001000101011110101111001010111111110110010001001100011111011110011111011101100000101000010101100101010110001101001101011110001101001110101001011110110001011001111111010011110101010011111100001111110101011100111010111100011000111111,0
00001001101001111010111011111101111010011110100010010110001001010001101101001100010101010001011001010000110101111011010100001000001111011011101010110011101111111011011001011110111001100001000101010111101011000101111100110010100100001110011000011111000100100001101001110001101111010111100000010011110111100000010001101011010101111010101111101101001110001000101000100100010010110110010001101101000011001011001001011001011010010101111001000000101011010010001111100010111110000110111111011010010100101110110001010000,0
00110010011011111011111111101011000110001000101101110000111101010001001001100010011111001001101000001110001101000100101100110101110101110101000010100100010111110101010110001001101001101101010011000111100011101001100001001100111111101111101011010101110011001001001010100101011101001000000011110001101011100110101000111110100111000000011011000000111111001110000011111011001101100000011110011010001011001111101111001101100010111101011101110111110111010100100011111110010000000001101000110100010110110101101100001000,0
01010100111110111111110010010011100001111010011101011100010110011001100111010100011100101010001000110110111010100010101010010101110000010111101101011111000111110110111000000101000011110111100101010010011110000010010111110000000111101101100001101110000100101011101001011110110111001010000000110011111101101111111100001011101010011001100001010000100011101010001011001101000101111100101111000110110000111000110011001100110011110001111111010010001101101011001110101001111101100000101001000110010110100100011100111001,0
11100101001000111111010101001000010101000111100001101011001101011100000101001111001101010100010101100010010111010000001011000000001011001011101011110110100101111100010011101100101001010001011110010000010101010111100111100011001001010111101110111010110101000100100101001010011000010110011010111100010011010001110000000001000001000101010011010110101000101111100100011110100111011000110100001000111011111010110000111111111010010100000000011101110101011011011000011100110001101100010000011010010001010011111101110110,0
11000110100010100111100000110110100111111111011110111000000011001011001101010000011000011100000011110100010001111001110001100000011001000111111011000011100010010101110001011110000000111011011110011011110000111101110011101000101111001111000000110110000001111110101001111010111111000000100110000110001000010001101110111001100001110110111111010111110111101011001111111100101100001100101101001100111001111111000011001100010001010110110011111000001101100000101000100101000000010010110110100000100111111100010101001101,0
00000001000011110101001100100100010100111110111010000011010000011100111101011100100000101101101101110011011100011000001111101010010111110110111000101000101000011000100011001001111100110110000111111001100111001000110100010101110001111000111111111000111111101010000101010001010010111010101011101010011000001001110101001000000101001001100011100110101000100011111100011010110111000101101101101100011111110010001000010111000111101010000110111001000000100111001010010110110110010001000100001101001011000000000001000101,0
00000010110100110110001000110010001110001010110011100001100100100110010011000010110011011100000010000111001110110011011101100100111010010100001100110001111001010100000101000110111010101111101001011001110110010111001001011000001101100111001100000011101000001110001111010100001111100111001000010110010000010000110000000011100101110100011000011010110111111100110010010110111001001111010011100011000010110011000010010111001110110100101101010011011001110110011000001101101111000111001010001000001100001011100110001000,0
11101100010100011110000101100111001101111010001000111111011010100110101010111101100011110001011111110101110001001010000010100110000110100001111000001000000100111110001001101000111000011100001101011101111000100110011010110000100111110001100001101100011110001011010101101111110010001101101110101100001001010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000100110010,1
c958eb83883f42ae1c2214f410d263a401f18dd0b10ac1141e8ad4f60403382fe50b0b115ebcaff644c7de7dd82856558d35e34ea5ec59fd3d53f0fd5cebc63f,0
9a7aefde9e896251b4c551650d7b5083dbab3bfb65ee61157ac5f3290e61f121a71bd7813de046b57abed388a244b646d0cb259695e40ad23e2f86fda52ec50,0
326fbfeb188b70f512627c9a0e344b35d750a45f5589a6d4c78e984cfefad5cc92a57480f1ae6a3e9c06c0fce0fb36079a2cfbcd8bd777dd48fe401a345b5b08,0
54fbfc9387a75c5999d472a236ea2a95c17b5f1f6e050f79527825f01ed86e12ba5edca033f6ff0ba998508ea2cd17cbc6c38ccccf1fd236b3a9f60a465a4739,0
e523f54854786b35c14f3545625d02c02cbaf697c4eca517905579e3257bbad4494a6166bc4d1c010454d6a2f91e9d8d08efac3fe9401dd5b61cc6c41a453f76,0
c68a78369ff7b80cb35061c0f4479c60647ec3895c5e03b79bc3dce8bcf03607ea7afc0986211bb9876fd7deb3fcb0cb4ce7f0cc456cf8360a25012da09fc54d,0
10f532453ee8341cf5c82db737183ea5f6e28a188c9f361f99c8d15c78ff8fea1514baaea609d481498e6a23f1adc5b6c7f22171ea1b9027296d9110d2c0045,0
2d3623238ace19264c2cdc0873b3764e94331e54146eafa59d97258367303a0e3d43e7216410c0397461adfcc96e4f4e30b30973b4b5367660dbc728830b988,0
ec51e16737a23f6a6abd8f17f5c4a0a61a1e0813e268e1c35de266b09f186c78b56fc8dbac254000000000000000000000000000000000000000000000001132,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
0000000000000000000000000000000000000000000000000001000100110010,00,1
c958eb83883f42ae1c2214f410d263a401f18dd0b10ac1141e8ad4f60403382fe50b0b115ebcaff644c7de7dd82856558d35e34ea5ec59fd3d53f0fd5cebc63f,0
9a7aefde9e896251b4c551650d7b5083dbab3bfb65ee61157ac5f3290e61f121a71bd7813de046b57abed388a244b646d0cb259695e40ad23e2f86fda52ec50,0
326fbfeb188b70f512627c9a0e344b35d750a45f5589a6d4c78e984cfefad5cc92a57480f1ae6a3e9c06c0fce0fb36079a2cfbcd8bd777dd48fe401a345b5b08,0
54fbfc9387a75c5999d472a236ea2a95c17b5f1f6e050f79527825f01ed86e12ba5edca033f6ff0ba998508ea2cd17cbc6c38ccccf1fd236b3a9f60a465a4739,0
e523f54854786b35c14f3545625d02c02cbaf697c4eca517905579e3257bbad4494a6166bc4d1c010454d6a2f91e9d8d08efac3fe9401dd5b61cc6c41a453f76,0
c68a78369ff7b80cb35061c0f4479c60647ec3895c5e03b79bc3dce8bcf03607ea7afc0986211bb9876fd7deb3fcb0cb4ce7f0cc456cf8360a25012da09fc54d,0
10f532453ee8341cf5c82db737183ea5f6e28a188c9f361f99c8d15c78ff8fea1514baaea609d481498e6a23f1adc5b6c7f22171ea1b9027296d9110d2c0045,0
2d3623238ace19264c2cdc0873b3764e94331e54146eafa59d97258367303a0e3d43e7216410c0397461adfcc96e4f4e30b30973b4b5367660dbc728830b988,0
ec51e16737a23f6a6abd8f17f5c4a0a61a1e0813e268e1c35de266b09f186c78b56fc8dbac254000000000000000000000000000000000000000000000001132,1
11001001010110001110101110000011100010000011111101000010101011100001110000100010000101001111010000010000110100100110001110100100000000011111000110001101110100001011000100001010110000010001010000011110100010101101010011110110000001000000001100111000001011111110010100001011000010110001000101011110101111001010111111110110010001001100011111011110011111011101100000101000010101100101010110001101001101011110001101001110101001011110110001011001111111010011110101010011111100001111110101011100111010111100011000111111,0
00001001101001111010111011111101111010011110100010010110001001010001101101001100010101010001011001010000110101111011010100001000001111011011101010110011101111111011011001011110111001100001000101010111101011000101111100110010100100001110011000011111000100100001101001110001101111010111100000010011110111100000010001101011010101111010101111101101001110001000101000100100010010110110010001101101000011001011001001011001011010010101111001000000101011010010001111100010111110000110111111011010010100101110110001010000,0
00110010011011111011111111101011000110001000101101110000111101010001001001100010011111001001101000001110001101000100101100110101110101110101000010100100010111110101010110001001101001101101010011000111100011101001100001001100111111101111101011010101110011001001001010100101011101001000000011110001101011100110101000111110100111000000011011000000111111001110000011111011001101100000011110011010001011001111101111001101100010111101011101110111110111010100100011111110010000000001101000110100010110110101101100001000,0
01010100111110111111110010010011100001111010011101011100010110011001100111010100011100101010001000110110111010100010101010010101110000010111101101011111000111110110111000000101000011110111100101010010011110000010010111110000000111101101100001101110000100101011101001011110110111001010000000110011111101101111111100001011101010011001100001010000100011101010001011001101000101111100101111000110110000111000110011001100110011110001111111010010001101101011001110101001111101100000101001000110010110100100011100111001,0
11100101001000111111010101001000010101000111100001101011001101011100000101001111001101010100010101100010010111010000001011000000001011001011101011110110100101111100010011101100101001010001011110010000010101010111100111100011001001010111101110111010110101000100100101001010011000010110011010111100010011010001110000000001000001000101010011010110101000101111100100011110100111011000110100001000111011111010110000111111111010010100000000011101110101011011011000011100110001101100010000011010010001010011111101110110,0
11000110100010100111100000110110100111111111011110111000000011001011001101010000011000011100000011110100010001111001110001100000011001000111111011000011100010010101110001011110000000111011011110011011110000111101110011101000101111001111000000110110000001111110101001111010111111000000100110000110001000010001101110111001100001110110111111010111110111101011001111111100101100001100101101001100111001111111000011001100010001010110110011111000001101100000101000100101000000010010110110100000100111111100010101001101,0
00000001000011110101001100100100010100111110111010000011010000011100111101011100100000101101101101110011011100011000001111101010010111110110111000101000101000011000100011001001111100110110000111111001100111001000110100010101110001111000111111111000111111101010000101010001010010111010101011101010011000001001110101001000000101001001100011100110101000100011111100011010110111000101101101101100011111110010001000010111000111101010000110111001000000100111001010010110110110010001000100001101001011000000000001000101,0
00000010110100110110001000110010001110001010110011100001100100100110010011000010110011011100000010000111001110110011011101100100111010010100001100110001111001010100000101000110111010101111101001011001110110010111001001011000001101100111001100000011101000001110001111010100001111100111001000010110010000010000110000000011100101110100011000011010110111111100110010010110111001001111010011100011000010110011000010010111001110110100101101010011011001110110011000001101101111000111001010001000001100001011100110001000,0
11101100010100011110000101100111001101111010001000111111011010100110101010111101100011110001011111110101110001001010000010100110000110100001111000001000000100111110001001101000111000011100001101011101111000100110011010110000100111110001100001101100011110001011010101101111110010001101101110101100001001010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000100110010,1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment