From c85f6638d09618fe82f816af61df60c1cb4ed4c7 Mon Sep 17 00:00:00 2001 From: JanLJL Date: Thu, 16 May 2019 16:34:53 +0200 Subject: [PATCH] supports directives in the kernel --- osaca/__init__.py | 2 +- osaca/eu_sched.py | 4 +++- osaca/osaca.py | 12 ++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osaca/__init__.py b/osaca/__init__.py index 5a37918..d71aa54 100644 --- a/osaca/__init__.py +++ b/osaca/__init__.py @@ -1,2 +1,2 @@ name = "osaca" -__version__ = '0.2.1' +__version__ = '0.2.2' diff --git a/osaca/eu_sched.py b/osaca/eu_sched.py index 81c279e..2e9ab90 100755 --- a/osaca/eu_sched.py +++ b/osaca/eu_sched.py @@ -99,6 +99,8 @@ class Scheduler(object): # Instruction form not in CSV if instrForm[0][:3] == 'nop': sched += self.format_port_occupation_line(occ_ports[i], '* ' + instrForm[-1]) + elif instrForm[0] == 'DIRECTIVE': + sched += self.format_port_occupation_line(occ_ports[i], '* ' + instrForm[-1]) else: sched += self.format_port_occupation_line(occ_ports[i], 'X ' + instrForm[-1]) continue @@ -324,7 +326,7 @@ class Scheduler(object): annotations = ( 'P - Load operation can be hidden behind a past or future store instruction\n' 'X - No information for this instruction in data file\n' - '* - Instruction micro-ops not bound to a port\n\n') + '* - Not bound to a port, therefore ignored\n\n') return analysis + annotations def get_head(self): diff --git a/osaca/osaca.py b/osaca/osaca.py index 3a5bda3..b51c5d4 100755 --- a/osaca/osaca.py +++ b/osaca/osaca.py @@ -451,13 +451,17 @@ class OSACA(object): empty_byte = re.compile(r'[0-9a-f]{2}') if re.match(empty_byte, mnemonic) and len(mnemonic) == 2: return - # Check if line contains a directive - directive = re.compile(r'^\.[a-zA-Z0-9]+$') - if re.match(directive, mnemonic): - return # Check if there's one or more operands and store all in a list param_list = flatten(self._separate_params(params)) param_list_types = list(param_list) + # Check if line contains a directive and if so, add as a workaround with + # marker in mnemonic + directive = re.compile(r'^\.[a-zA-Z0-9]+$') + if re.match(directive, mnemonic): + instr = instr.rstrip() + instr_form = ['DIRECTIVE'] + list() + [instr] + self.instr_forms.append(instr_form) + return # Check operands and separate them by IMMEDIATE (IMD), REGISTER (REG), # MEMORY (MEM) or LABEL(LBL) for i, op in enumerate(param_list):