res = '\n'.join(map(self.wirefmtpin, self.pins)).format(*args)
res += '\n'
return '\n' + res
- for p in self.pinspecs:
- name = self.pname(p['name'])
- typ = self.getifacetype(name.format(""))
- name = name.format(*args)
- res += " // declare %s_io set up as type '%s'\n" % (name, typ)
- res += " GenericIOType %s_io = GenericIOType{\n" % name
- params = []
- if typ == 'inout':
- outname = self.ifacefmtoutfn(name)
- params.append('outputval:%s_out,' % outname)
- params.append('output_en:%s_outen,' % outname) # match busfmt
- params.append('input_en:~%s_outen,' % outname)
- elif typ == 'out':
- outname = self.ifacefmtoutfn(name)
- params.append('outputval:%s,' % outname)
- params.append('output_en:1,')
- params.append('input_en:0,')
- else: # input
- params.append('outputval:0,')
- params.append('output_en:0,')
- params.append('input_en:1,')
- for param in params:
- res += ' %s\n' % param
- res += ' };\n'
- return '\n' + res
def ifacefmt(self, *args):
res = '\n'.join(map(self.ifacefmtdecpin, self.pins)).format(*args)
header = copyright + '''
package pinmux;
- // FunctionType: contains the active wires of a function. That INCLUDES
- // GPIO (as GPIO is also a "Function"). These are what get muxed.
- // However, only GPIO "Functions" will end up with Register SRAMs.
- typedef struct{
- Bit#(1) outputval; // output from function to pad bit2
- Bit#(1) inputval; // input from pad to function bit1
- Bit#(1) output_en; // output enable from core to pad bit0
- } FunctionType deriving(Eq,Bits,FShow);
-
- typedef struct{
- Bit#(1) outputval; // output from core to pad bit7
- Bit#(1) output_en; // output enable from core to pad bit6
- Bit#(1) input_en; // input enable from core to io_cell bit5
- } GenericIOType deriving(Eq,Bits,FShow);
-
'''
footer = '''
endinterface;
package pinmux;
- // FunctionType: contains the active wires of a function. That INCLUDES
- // GPIO (as GPIO is also a "Function"). These are what get muxed.
- // However, only GPIO "Functions" will end up with Register SRAMs.
- typedef struct{
- Bit#(1) outputval; // output from function to pad bit2
- Bit#(1) inputval; // input from pad to function bit1
- Bit#(1) output_en; // output enable from core to pad bit0
- } FunctionType deriving(Eq,Bits,FShow);
-
- typedef struct{
- Bit#(1) outputval; // output from core to pad bit7
- Bit#(1) output_en; // output enable from core to pad bit6
- Bit#(1) input_en; // input enable from core to io_cell bit5
- } GenericIOType deriving(Eq,Bits,FShow);
-
interface MuxSelectionLines;
// declare the method which will capture the user pin-mux