Line 1... |
Line 1... |
################################################################################
|
################################################################################
|
#
|
#
|
# Copyright 2013, Sinclair R.F., Inc.
|
# Copyright 2013-2014, Sinclair R.F., Inc.
|
#
|
#
|
################################################################################
|
################################################################################
|
|
|
import math;
|
import math;
|
import re;
|
import re;
|
Line 66... |
Line 66... |
('data', r'o_\w+$', None, ),
|
('data', r'o_\w+$', None, ),
|
('data_rd', r'i_\w+$', None, ),
|
('data_rd', r'i_\w+$', None, ),
|
('data_empty', r'o_\w+$', None, ),
|
('data_empty', r'o_\w+$', None, ),
|
('outport', r'O_\w+$', None, ),
|
('outport', r'O_\w+$', None, ),
|
('infull', r'I_\w+$', None, ),
|
('infull', r'I_\w+$', None, ),
|
('depth', r'[1-9]\d*$', int, ),
|
('depth', r'[1-9]\d*$', lambda v : self.IntPow2(v,minValue=16), ),
|
);
|
);
|
names = [a[0] for a in allowables];
|
names = [a[0] for a in allowables];
|
for param_tuple in param_list:
|
for param_tuple in param_list:
|
param = param_tuple[0];
|
param = param_tuple[0];
|
if param not in names:
|
if param not in names:
|
Line 79... |
Line 79... |
self.AddAttr(config,param,param_tuple[1],param_test[1],loc,param_test[2]);
|
self.AddAttr(config,param,param_tuple[1],param_test[1],loc,param_test[2]);
|
# Ensure the required parameters are provided.
|
# Ensure the required parameters are provided.
|
for paramname in names:
|
for paramname in names:
|
if not hasattr(self,paramname):
|
if not hasattr(self,paramname):
|
raise SSBCCException('Required parameter "%s" is missing at %s' % (paramname,loc,));
|
raise SSBCCException('Required parameter "%s" is missing at %s' % (paramname,loc,));
|
# Ensure the depth is a power of 2.
|
|
if not IsPowerOf2(self.depth):
|
|
raise SSBCCException('depth=%d must be a power of 2 at %s' % (self.depth,loc,));
|
|
if self.depth < 16:
|
|
raise SSBCCException('depth=%d must be at least 16 at %s' % (self.depth,loc,));
|
|
# Add the I/O port, internal signals, and the INPORT and OUTPORT symbols for this peripheral.
|
# Add the I/O port, internal signals, and the INPORT and OUTPORT symbols for this peripheral.
|
config.AddIO(self.outclk,1,'input',loc);
|
config.AddIO(self.outclk,1,'input',loc);
|
config.AddIO(self.data,8,'output',loc);
|
config.AddIO(self.data,8,'output',loc);
|
config.AddIO(self.data_rd,1,'input',loc);
|
config.AddIO(self.data_rd,1,'input',loc);
|
config.AddIO(self.data_empty,1,'output',loc);
|
config.AddIO(self.data_empty,1,'output',loc);
|