Skip to content
Snippets Groups Projects
Commit 196ecaaf authored by dam1n19's avatar dam1n19
Browse files

UPdate Stimgen script to create adp commands

parent 0c8cc332
No related branches found
No related tags found
No related merge requests found
...@@ -17,22 +17,20 @@ class TransactionType(Enum): ...@@ -17,22 +17,20 @@ class TransactionType(Enum):
READ = 1 READ = 1
WRITE = 2 WRITE = 2
def __str__(self): def __str__(self):
match self: if (self == TransactionType.READ):
case TransactionType.READ: return "R"
return "R" elif (self == TransactionType.WRITE):
case TransactionType.WRITE: return "W"
return "W"
class TransactionSize(Enum): class TransactionSize(Enum):
""" Enumerated Types for Transaction Types for ASCII Debug """ """ Enumerated Types for Transaction Types for ASCII Debug """
WORD = 1 WORD = 1
HALFWORD = 2 HALFWORD = 2
def __str__(self): def __str__(self):
match self: if (self == TransactionSize.WORD):
case TransactionSize.WORD: return "word"
return "word" elif (self == TransactionSize.HALFWORD):
case TransactionSize.HALFWORD: return "halfword"
return "halfword"
class InputBlockStruct: class InputBlockStruct:
def __init__(self): def __init__(self):
...@@ -57,6 +55,28 @@ class WordStruct: ...@@ -57,6 +55,28 @@ class WordStruct:
self.block_num = block_num self.block_num = block_num
self.size = size self.size = size
def adp_output(out_file, word_list):
"""
This function takes a list of 32 bit words and addresses and formats
the data into .cmd format for the ADP module
testbench
"""
data = []
for word in word_list:
if (word.data > 0):
data.append(["a", "{0:#0{1}x}".format(word.addr,10)])
data.append([str(word.trans).lower(), "{0:#0{1}x}".format(word.data,10)])
table_str = tabulate.tabulate(data, headers=col_names, tablefmt="plain")
with open(out_file, "w", encoding="UTF8", newline='') as f:
f.write("A")
f.write(table_str)
f.write(" A")
f.write("X")
f.write("!")
def fri_output(out_file, word_list): def fri_output(out_file, word_list):
""" """
This function takes a list of 32 bit words and addresses and formats This function takes a list of 32 bit words and addresses and formats
...@@ -167,6 +187,10 @@ def stimulus_generation(stim_file, ref_file, input_start_address, input_size, ou ...@@ -167,6 +187,10 @@ def stimulus_generation(stim_file, ref_file, input_start_address, input_size, ou
read_addr += 0x4 read_addr += 0x4
# Generate ADP Command File with Write Transactions
adp_file = os.environ["WRAP_ACC_DIR"] + "/simulate/stimulus/" + "adp_hash_stim.cmd"
adp_output(adp_file, output_word_list)
# Generate FRI File with Write Transactions # Generate FRI File with Write Transactions
fri_file = os.environ["WRAP_ACC_DIR"] + "/simulate/stimulus/" + "ahb_input_hash_stim.fri" fri_file = os.environ["WRAP_ACC_DIR"] + "/simulate/stimulus/" + "ahb_input_hash_stim.fri"
fri_output(fri_file, output_word_list) fri_output(fri_file, output_word_list)
......
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