0dbe9228115aac80c2c67412b9ac0d4d6c34aa67
[pinmux.git] / src / interface_def.py
1 # === templates for interface definitions ====== #
2 mux_interface_def = '''
3 method Action cell{0}_mux(Bit#({1}) in);
4 wrcell{0}_mux<=in;
5 endmethod
6 '''
7 io_interface_def = '''
8 method io_outputval_{0}=cell{0}_mux_out.outputval;
9 method io_output_en_{0}=cell{0}_mux_out.output_en;
10 method io_input_en_{0}=cell{0}_mux_out.input_en;
11 method io_pullup_en_{0}=cell{0}_mux_out.pullup_en;
12 method io_pulldown_en_{0}=cell{0}_mux_out.pulldown_en;
13 method io_drivestrength_{0}=cell{0}_mux_out.drivestrength;
14 method io_pushpull_en_{0}=cell{0}_mux_out.pushpull_en;
15 method io_opendrain_en_{0}=cell{0}_mux_out.opendrain_en;
16 method Action io_inputval_{0}(Bit#(1) in);
17 cell{0}_mux_in<=in;
18 endmethod
19 '''
20 uartinterface_def = '''
21 method uart{0}_rx=wruart{0}_rx;
22 method Action uart{0}_tx(Bit#(1) in);
23 wruart{0}_tx<=in;
24 endmethod
25 '''
26 spiinterface_def = '''
27 method Action spi{0}_sclk (Bit#(1) in);
28 wrspi{0}_sclk<=in;
29 endmethod
30 method Action spi{0}_mosi (Bit#(1) in);
31 wrspi{0}_mosi<=in;
32 endmethod
33 method Action spi{0}_nss (Bit#(1) in);
34 wrspi{0}_nss<=in;
35 endmethod
36 method Bit#(1) spi{0}_miso=wrspi{0}_miso;
37 '''
38
39 twiinterface_def = '''
40
41 method Action twi{0}_sda_out (Bit#(1) in);
42 wrtwi{0}_sda_out<=in;
43 endmethod
44 method Action twi{0}_sda_outen (Bit#(1) in);
45 wrtwi{0}_sda_outen<=in;
46 endmethod
47 method twi{0}_sda_in=wrtwi{0}_sda_in;
48
49 method Action twi{0}_scl_out (Bit#(1) in);
50 wrtwi{0}_scl_out<=in;
51 endmethod
52 method Action twi{0}_scl_outen (Bit#(1) in);
53 wrtwi{0}_scl_outen<=in;
54 endmethod
55 method twi{0}_scl_in=wrtwi{0}_scl_in;
56
57 '''
58
59 sdinterface_def = '''
60 method Action sd{0}_clk (Bit#(1) in);
61 wrsd{0}_clk<=in;
62 endmethod
63 method Action sd{0}_cmd (Bit#(1) in);
64 wrsd{0}_cmd<=in;
65 endmethod
66 method Action sd{0}_d0_out (Bit#(1) in);
67 wrsd{0}_d0_out<=in;
68 endmethod
69 method Action sd{0}_d0_outen (Bit#(1) in);
70 wrsd{0}_d0_outen<=in;
71 endmethod
72 method sd{0}_d0_in=wrsd{0}_d0_in;
73 method Action sd{0}_d1_out (Bit#(1) in);
74 wrsd{0}_d1_out<=in;
75 endmethod
76 method Action sd{0}_d1_outen (Bit#(1) in);
77 wrsd{0}_d1_outen<=in;
78 endmethod
79 method sd{0}_d1_in=wrsd{0}_d1_in;
80 method Action sd{0}_d2_out (Bit#(1) in);
81 wrsd{0}_d2_out<=in;
82 endmethod
83 method Action sd{0}_d2_outen (Bit#(1) in);
84 wrsd{0}_d2_outen<=in;
85 endmethod
86 method sd{0}_d2_in=wrsd{0}_d2_in;
87 method Action sd{0}_d3_out (Bit#(1) in);
88 wrsd{0}_d3_out<=in;
89 endmethod
90 method Action sd{0}_d3_outen (Bit#(1) in);
91 wrsd{0}_d3_outen<=in;
92 endmethod
93 method sd{0}_d3_in=wrsd{0}_d3_in;
94 '''
95
96 jtaginterface_def = '''
97 method Bit#(1) jtag{0}_tdi=wrjtag{0}_tdi;
98 method Bit#(1) jtag{0}_tms=wrjtag{0}_tms;
99 method Bit#(1) jtag{0}_tclk=wrjtag{0}_tclk;
100 method Bit#(1) jtag{0}_trst=wrjtag{0}_trst;
101 method Action jtag{0}_tdo(Bit#(1) in);
102 wrjtag{0}_tdo<=in;
103 endmethod
104 '''
105
106 pwminterface_def = '''
107 method Action pwm{0}_pwm(Bit#(1) in);
108 wrpwm{0}_pwm<=in;
109 endmethod
110 '''
111 # ============================================== #