Commit 2b26a42d authored by leon@uji.es's avatar leon@uji.es
Browse files

Crossbar total

parent 460770cd
......@@ -22,6 +22,7 @@ class BitFlip:
self.__fault_model = kwargs.get('fault_model')
self.__logging = kwargs.get('logging')
self.__injection_site = kwargs.get('injection_site')
self.__maxregs=kwargs.get('max_regs')
self.fault_injected = False
"""
......@@ -200,17 +201,17 @@ class BitFlip:
def __select_register(self):
# Start on 1 to consider R0
max_num_register = 0
#max_num_register =
# registers_list.popleft()
registers_list = cf.execute_command(gdb=gdb, to_execute="info registers")
for line in registers_list:
m = re.match(r".*R.*0x([0-9a-fA-F]+).*", line)
if m and m.group(1) != '0':
#registers_list = cf.execute_command(gdb=gdb, to_execute="info registers")
#for line in registers_list:
# m = re.match(r".*R.*0x([0-9a-fA-F]+).*", line)
# if m and m.group(1) != '0':
#self.__logging.info ("LIne salida:{}".format(m.group(1))
max_num_register += 1
# max_num_register += 1
#self.__logging.info("LIne entrada {}--max{}".format(line,max_num_register))
self.__register = "R{}".format(random.randint(0, max_num_register-1))
self.__logging.info("MAX_NUM_REGISTER:{}".format(max_num_register))
self.__register = "R{}".format(random.randint(0, self.__maxregs-1))
self.__logging.info("MAX_NUM_REGISTER:{}".format(self.__maxregs))
"""
Instruction injector
"""
......
......@@ -332,6 +332,7 @@ def gdb_inject_fault(**kwargs):
seq_signals = kwargs.get('seq_signals')
init_sleep = kwargs.get('init_sleep')
sdc_check_script = kwargs.get('gold_check_script')
maxregs=kwargs.get('max_regs').
# signalCmd
signal_cmd = kwargs.get("signal_cmd")
......@@ -355,7 +356,7 @@ def gdb_inject_fault(**kwargs):
logging.info("Starting GDB script")
# Generate configuration file for specific test
gdb_env_string = "{}|{}|{}|{}|{}|file {}; set args {}|{}".format(gdb_kernel,os.getpid(),",".join(str(i) for i in bits_to_flip), fault_model,
gdb_env_string = "{}|{}|{}|{}|{}|{}|file {}; set args {}|{}".format(gdb_kernel,os.getpid(),max_regs,",".join(str(i) for i in bits_to_flip), fault_model,
flip_log_file, benchmark_binary, benchmark_args,
injection_site)
......
......@@ -74,7 +74,7 @@ def main():
# Get variables values from environment
# Firsn parse line
[kernel,pid,bits_to_flip, fault_model, flip_log_file,
[kernel,pid,max_regs,bits_to_flip, fault_model, flip_log_file,
gdb_init_strings, injection_site] = arg0.split('|')
# Logging
......@@ -91,7 +91,7 @@ def main():
# Set Breakpoint attributes to be use
bits_to_flip = [i for i in bits_to_flip.split(",")]
fault_model = int(fault_model)
bit_flip = BitFlip(bits_to_flip=bits_to_flip, fault_model=fault_model,
bit_flip = BitFlip(bits_to_flip=bits_to_flip, fault_model=fault_model,max_regs=max_regs,
logging=global_logging, injection_site=cp.INJECTION_SITES[injection_site])
# Start app execution
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment