renaming params.py to parse.py. Adding checks on input
[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 # ============================================== #