adding support for interface of SD/MMC.
[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 wrmux{0}<=in;
5 endmethod
6 '''
7 io_interface_def = '''
8 method io_outputval_{0}=cell{0}_out.outputval;
9 method io_output_en_{0}=cell{0}_out.output_en;
10 method io_input_en_{0}=cell{0}_out.input_en;
11 method io_pullup_en_{0}=cell{0}_out.pullup_en;
12 method io_pulldown_en_{0}=cell{0}_out.pulldown_en;
13 method io_drivestrength_{0}=cell{0}_out.drivestrength;
14 method io_pushpull_en_{0}=cell{0}_out.pushpull_en;
15 method io_opendrain_en_{0}=cell{0}_out.opendrain_en;
16 method Action io_inputval_{0}(Bit#(1) in);
17 cell{0}_in<=in;
18 endmethod
19 '''
20 uartinterface_def = '''
21 method rx_{0}=wruart{0}_rx;
22 method Action tx_{0}(Bit#(1) in);
23 wruart{0}_tx<=in;
24 endmethod
25 '''
26 spiinterface_def = '''
27 method Action sclk_{0} (Bit#(1) in);
28 wrspi{0}_sclk<=in;
29 endmethod
30 method Action mosi_{0} (Bit#(1) in);
31 wrspi{0}_mosi<=in;
32 endmethod
33 method Action ss_{0} (Bit#(1) in);
34 wrspi{0}_ss<=in;
35 endmethod
36 method Bit#(1) miso_{0}=wrspi{0}_miso;
37 '''
38
39 twiinterface_def = '''
40
41 method Action sda{0}_out (Bit#(1) in);
42 wrtwi{0}_sda_out<=in;
43 endmethod
44 method Action sda{0}_outen (Bit#(1) in);
45 wrtwi{0}_sda_outen<=in;
46 endmethod
47 method sda{0}_in=wrtwi{0}_sda_in;
48
49 method Action scl{0}_out (Bit#(1) in);
50 wrtwi{0}_scl_out<=in;
51 endmethod
52 method Action scl{0}_outen (Bit#(1) in);
53 wrtwi{0}_scl_outen<=in;
54 endmethod
55 method scl{0}_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 # ============================================== #