supports directives in the kernel

This commit is contained in:
JanLJL
2019-05-16 16:34:53 +02:00
parent 25d3c844d4
commit c85f6638d0
3 changed files with 12 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
name = "osaca"
__version__ = '0.2.1'
__version__ = '0.2.2'

View File

@@ -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):

View File

@@ -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):