Line 1... |
Line 1... |
################################################################################
|
################################################################################
|
#
|
#
|
# Copyright 2012-2014, Sinclair R.F., Inc.
|
# Copyright 2012-2015, Sinclair R.F., Inc.
|
#
|
#
|
################################################################################
|
################################################################################
|
|
|
import math;
|
import math;
|
import re;
|
import re;
|
Line 37... |
Line 37... |
baudmethod
|
baudmethod
|
specifies the method to generate the desired bit rate:
|
specifies the method to generate the desired bit rate:
|
1st method: clk/rate
|
1st method: clk/rate
|
clk is the frequency of "i_clk" in Hz
|
clk is the frequency of "i_clk" in Hz
|
a number will be interpreted as the clock frequency in Hz
|
a number will be interpreted as the clock frequency in Hz
|
a symbol will be interpreted as a parameter
|
a symbol will be interpreted as a constant or a parameter
|
Note: this parameter must have been declared with a "PARAMETER"
|
Note: the symbol must be declared with the CONSTANT, LOCALPARARM,
|
command
|
or PARAMETER configuration command.
|
rate is the desired baud rate
|
rate is the desired baud rate
|
this is specified as per "clk"
|
this is specified as per "clk"
|
2nd method:
|
2nd method:
|
specify the number of "i_clk" clock cycles between bit edges
|
specify the number of "i_clk" clock cycles between bit edges
|
Note: clk, rate, and count can be parameters or constants. For example,
|
Note: clk, rate, and count can be parameters or constants. For example,
|
Line 116... |
Line 116... |
( 'CTS', r'i_\w+$', None, ),
|
( 'CTS', r'i_\w+$', None, ),
|
( 'CTSn', r'i_\w+$', None, ),
|
( 'CTSn', r'i_\w+$', None, ),
|
( 'baudmethod', r'\S+$', lambda v : self.RateMethod(config,v), ),
|
( 'baudmethod', r'\S+$', lambda v : self.RateMethod(config,v), ),
|
( 'noOutFIFO', None, None, ),
|
( 'noOutFIFO', None, None, ),
|
( 'nStop', r'[12]$', int, ),
|
( 'nStop', r'[12]$', int, ),
|
( 'outFIFO', r'[1-9]\d*$', lambda v : self.IntPow2(v), ),
|
( 'outFIFO', r'[1-9]\d*$', lambda v : self.IntPow2Method(config,v), ),
|
( 'outport', r'O_\w+$', None, ),
|
( 'outport', r'O_\w+$', None, ),
|
( 'outsignal', r'o_\w+$', None, ),
|
( 'outsignal', r'o_\w+$', None, ),
|
( 'outstatus', r'I_\w+$', None, ),
|
( 'outstatus', r'I_\w+$', None, ),
|
);
|
);
|
names = [a[0] for a in allowables];
|
names = [a[0] for a in allowables];
|
Line 169... |
Line 169... |
( 'CTS', 1, 'input', ),
|
( 'CTS', 1, 'input', ),
|
( 'CTSn', 1, 'input', ),
|
( 'CTSn', 1, 'input', ),
|
):
|
):
|
if hasattr(self,ioEntry[0]):
|
if hasattr(self,ioEntry[0]):
|
config.AddIO(getattr(self,ioEntry[0]),ioEntry[1],ioEntry[2],loc);
|
config.AddIO(getattr(self,ioEntry[0]),ioEntry[1],ioEntry[2],loc);
|
config.AddSignal('s__%s__Tx' % self.namestring,8,loc);
|
config.AddSignalWithInit('s__%s__Tx' % self.namestring,8,None,loc);
|
config.AddSignal('s__%s__Tx_busy' % self.namestring,1,loc);
|
config.AddSignal('s__%s__Tx_busy' % self.namestring,1,loc);
|
config.AddSignal('s__%s__Tx_wr' % self.namestring,1,loc);
|
config.AddSignalWithInit('s__%s__Tx_wr' % self.namestring,1,None,loc);
|
config.AddOutport((self.outport,False,
|
config.AddOutport((self.outport,False,
|
('s__%s__Tx' % self.namestring,8,'data',),
|
('s__%s__Tx' % self.namestring,8,'data',),
|
('s__%s__Tx_wr' % self.namestring,1,'strobe',),
|
('s__%s__Tx_wr' % self.namestring,1,'strobe',),
|
),loc);
|
),loc);
|
config.AddInport((self.outstatus,
|
config.AddInport((self.outstatus,
|