initial commit with minimal templates
[pinmux.git] / src / interface_def.py
1 from params import *
2 #=== templates for interface definitions ======#
3 mux_interface_def='''
4 method Action cell{0}_mux (Bit#('''+str(N_MUX)+''') in );
5 wrmux{0}<=in;
6 endmethod
7 '''
8 io_interface_def='''
9 method io_outputval_{0}=cell{0}_out.outputval;
10 method io_output_en_{0}=cell{0}_out.output_en;
11 method io_input_en_{0}=cell{0}_out.input_en;
12 method io_pullup_en_{0}=cell{0}_out.pullup_en;
13 method io_pulldown_en_{0}=cell{0}_out.pulldown_en;
14 method io_drivestrength_{0}=cell{0}_out.drivestrength;
15 method io_pushpull_en_{0}=cell{0}_out.pushpull_en;
16 method io_opendrain_en_{0}=cell{0}_out.opendrain_en;
17 method Action io_inputval_{0}(Bit#(1) in);
18 cell{0}_in<=in;
19 endmethod
20 '''
21 uartinterface_def='''
22 method rx_{0}=wruart{0}_rx;
23 method Action tx_{0}(Bit#(1) in);
24 wruart{0}_tx<=in;
25 endmethod
26 '''
27 spiinterface_def='''
28 method Action sclk_{0} (Bit#(1) in);
29 wrspi{0}_sclk<=in;
30 endmethod
31 method Action mosi_{0} (Bit#(1) in);
32 wrspi{0}_mosi<=in;
33 endmethod
34 method Action ss_{0} (Bit#(1) in);
35 wrspi{0}_ss<=in;
36 endmethod
37 method Bit#(1) miso_{0}=wrspi{0}_miso;
38 '''
39 #==============================================#
40
41