Line 24... |
Line 24... |
Initialize the empty dictionaries holding the processor configuration
|
Initialize the empty dictionaries holding the processor configuration
|
parameters. Initialize the paths to search for peripherals.
|
parameters. Initialize the paths to search for peripherals.
|
"""
|
"""
|
self.config = dict(); # various settings, etc.
|
self.config = dict(); # various settings, etc.
|
self.constants = dict(); # CONSTANTs
|
self.constants = dict(); # CONSTANTs
|
|
self.defines = dict(); # defines
|
self.functions = dict(); # list of functions to define
|
self.functions = dict(); # list of functions to define
|
self.inports = list(); # INPORT definitions
|
self.inports = list(); # INPORT definitions
|
self.ios = list(); # List of I/Os
|
self.ios = list(); # List of I/Os
|
self.outports = list(); # OUTPORT definitions (see AddOutport)
|
self.outports = list(); # OUTPORT definitions (see AddOutport)
|
self.parameters = list(); # PARAMETERs and LOCALPARAMs
|
self.parameters = list(); # PARAMETERs and LOCALPARAMs
|
Line 64... |
Line 65... |
raise SSBCCException('CONSTANT "%s" already declared at %s' % (name,loc,));
|
raise SSBCCException('CONSTANT "%s" already declared at %s' % (name,loc,));
|
if not IsIntExpr(value):
|
if not IsIntExpr(value):
|
raise SSBCCException('Could not evaluate expression "%s" for constant at %s' % (value,loc,));
|
raise SSBCCException('Could not evaluate expression "%s" for constant at %s' % (value,loc,));
|
self.constants[name] = ParseIntExpr(value);
|
self.constants[name] = ParseIntExpr(value);
|
|
|
|
def AddDefine(self,name):
|
|
"""
|
|
Add the defined symbol.\n
|
|
name name for the symbol (must start with "D_")\n
|
|
Note: This is only invoked for the command line arguments so there is no
|
|
"loc" available.\n
|
|
Note: Defines can be declared more than once on the command line with no
|
|
ill effects.
|
|
"""
|
|
if not self.IsDefine(name):
|
|
self.AddSymbol(name);
|
|
self.defines[name] = 1;
|
|
|
def AddIO(self,name,nBits,iotype,loc):
|
def AddIO(self,name,nBits,iotype,loc):
|
"""
|
"""
|
Add an I/O signal to the processor interface to the system.\n
|
Add an I/O signal to the processor interface to the system.\n
|
name name of the I/O signal
|
name name of the I/O signal
|
nBits number of bits in the I/O signal
|
nBits number of bits in the I/O signal
|
Line 340... |
Line 354... |
if re.match(r'C_\w+$',name) and name in self.constants:
|
if re.match(r'C_\w+$',name) and name in self.constants:
|
return True;
|
return True;
|
else:
|
else:
|
return False;
|
return False;
|
|
|
|
def IsDefine(self,name):
|
|
"""
|
|
Indicate whether or not the specified symbol is a recognized define.
|
|
"""
|
|
if re.match(r'D_\w+$',name) and name in self.defines:
|
|
return True;
|
|
else:
|
|
return False;
|
|
|
def IsMemory(self,name):
|
def IsMemory(self,name):
|
"""
|
"""
|
Indicate whether or not the specified symbol is the name of a memory.
|
Indicate whether or not the specified symbol is the name of a memory.
|
"""
|
"""
|
return (name in self.memories['name']);
|
return (name in self.memories['name']);
|