Line 39... |
Line 39... |
self.memories = dict(name=list(), type=list(), maxLength=list());
|
self.memories = dict(name=list(), type=list(), maxLength=list());
|
|
|
# list of how the memories will be instantiated
|
# list of how the memories will be instantiated
|
self.config['combine'] = list();
|
self.config['combine'] = list();
|
|
|
|
# initial search path for .INCLUDE configuration commands
|
|
self.includepaths = list();
|
|
self.includepaths.append('.');
|
|
|
# initial search paths for peripherals
|
# initial search paths for peripherals
|
self.peripheralpaths= list();
|
self.peripheralpaths= list();
|
self.peripheralpaths.append('.');
|
self.peripheralpaths.append('.');
|
self.peripheralpaths.append('peripherals');
|
self.peripheralpaths.append('peripherals');
|
self.peripheralpaths.append(os.path.join(sys.path[0],'core/peripherals'));
|
self.peripheralpaths.append(os.path.join(sys.path[0],'core/peripherals'));
|
Line 161... |
Line 165... |
raise SSBCCException('Symbol "%s" already defined, no line number provided');
|
raise SSBCCException('Symbol "%s" already defined, no line number provided');
|
else:
|
else:
|
raise SSBCCException('Symbol "%s" already defined before %s' % (name,loc,));
|
raise SSBCCException('Symbol "%s" already defined before %s' % (name,loc,));
|
self.symbols.append(name);
|
self.symbols.append(name);
|
|
|
|
def AppendIncludePath(self,path):
|
|
"""
|
|
Add the specified path to the end of the paths to search for .INCLUDE
|
|
configuration commands.\n
|
|
path path to add to the list
|
|
"""
|
|
self.includepaths.insert(-1,path);
|
|
|
def CompleteCombines(self):
|
def CompleteCombines(self):
|
"""
|
"""
|
Ensure all memories are assigned addresses.\n
|
Ensure all memories are assigned addresses.\n
|
This modifies config['combine'] to include singleton entries for any
|
This modifies config['combine'] to include singleton entries for any
|
memories not subject to the COMBINE configuration command. It then computes
|
memories not subject to the COMBINE configuration command. It then computes
|
Line 292... |
Line 304... |
name = name[:ix];
|
name = name[:ix];
|
else:
|
else:
|
thisSlice = '[0+:8]';
|
thisSlice = '[0+:8]';
|
for ix in range(len(self.parameters)):
|
for ix in range(len(self.parameters)):
|
if self.parameters[ix][0] == name:
|
if self.parameters[ix][0] == name:
|
return ExtractBits(int(self.parameters[ix][1]),thisSlice);
|
return ExtractBits(IntValue(self.parameters[ix][1]),thisSlice);
|
else:
|
else:
|
raise Exception('Program Bug: Parameter "%s" not found' % name);
|
raise Exception('Program Bug: Parameter "%s" not found' % name);
|
|
|
def InsertPeripheralPath(self,path):
|
def InsertPeripheralPath(self,path):
|
"""
|
"""
|
Line 802... |
Line 814... |
else:
|
else:
|
blockSize = int(value[0:findStar]);
|
blockSize = int(value[0:findStar]);
|
nBlocks = int(value[findStar+1:]);
|
nBlocks = int(value[findStar+1:]);
|
nbits_blockSize = int(round(math.log(blockSize,2)));
|
nbits_blockSize = int(round(math.log(blockSize,2)));
|
if blockSize != 2**nbits_blockSize:
|
if blockSize != 2**nbits_blockSize:
|
raise SSBCCException('block size must be a power of 2 on line %d: "%s"' % errorInfo);
|
raise SSBCCException('block size must be a power of 2 at %s: "%s"' % errorInfo);
|
nbits_nBlocks = CeilLog2(nBlocks);
|
nbits_nBlocks = CeilLog2(nBlocks);
|
self.Set(name, dict(
|
self.Set(name, dict(
|
length=blockSize*nBlocks,
|
length=blockSize*nBlocks,
|
nbits=nbits_blockSize+nbits_nBlocks,
|
nbits=nbits_blockSize+nbits_nBlocks,
|
blockSize=blockSize,
|
blockSize=blockSize,
|