code clean using pep8 and autopep8.
[pinmux.git] / src / interface_decl.py
1 from params import *
2
3 # ========= Interface declarations ================ #
4 mux_interface = '''
5 method Action cell{0}_mux(Bit#(''' + str(N_MUX) + ''') in);'''
6
7 io_interface = '''
8 (*always_ready*) method Bit#(1) io_outputval_{0};
9 (*always_ready*) method Bit#(1) io_output_en_{0};
10 (*always_ready*) method Bit#(1) io_input_en_{0};
11 (*always_ready*) method Bit#(1) io_pullup_en_{0};
12 (*always_ready*) method Bit#(1) io_pulldown_en_{0};
13 (*always_ready*) method Bit#(1) io_drivestrength_{0};
14 (*always_ready*) method Bit#(1) io_pushpull_en_{0};
15 (*always_ready*) method Bit#(1) io_opendrain_en_{0};
16 (*always_ready,always_enabled,result="io"*)
17 method Action io_inputval_{0}(Bit#(1) in);
18 '''
19 # == Peripheral Interface definitions == #
20 # these are the interface of the peripherals to the pin mux
21 # Outputs from the peripherals will be inputs to the pinmux
22 # module. Hence the change in direction for most pins
23
24 uartinterface_decl = '''
25 (*always_ready,always_enabled*) method Action tx_{0}(Bit#(1) in);
26 (*always_ready,always_enabled*) method Bit#(1) rx_{0};
27 '''
28
29 spiinterface_decl = '''
30 (*always_ready,always_enabled*) method Action sclk_{0} (Bit#(1) in);
31 (*always_ready,always_enabled*) method Action mosi_{0} (Bit#(1) in);
32 (*always_ready,always_enabled*) method Action ss_{0} (Bit#(1) in);
33 (*always_ready,always_enabled*) method Bit#(1) miso_{0};
34 '''
35
36 twiinterface_decl = '''
37 (*always_ready,always_enabled*) method Action sda{0}_out (Bit#(1) in);
38 (*always_ready,always_enabled*) method Action sda{0}_outen (Bit#(1) in);
39 (*always_ready,always_enabled*) method Bit#(1) sda{0}_in;
40 (*always_ready,always_enabled*) method Action scl{0}_out (Bit#(1) in);
41 (*always_ready,always_enabled*) method Action scl{0}_outen (Bit#(1) in);
42 (*always_ready,always_enabled*) method Bit#(1) scl{0}_in;
43 '''
44 # ======================================= #