+
+ def ifacedef2(self, *args):
+ res = '\n'.join(map(self.ifacedef2pin, self.pins))
+ res = res.format(*args)
+
+ tdecl = """\
+ Vector#({0},Bit#(1)) tput;
+ Vector#({0},Bit#(1)) tputen;
+ Vector#({0},Bit#(1)) tget;
+""".format(len(self.pinspecs))
+ template = """\
+ interface gpio_out = interface Put#
+ method Action put(Vector#({0},Bit#(1)) in);
+ tput<=in;
+ endmethod
+ endinterface;
+ interface gpio_outen = interface Put#
+ method Action put(Vector#({0},Bit#(1)) in);
+ tputen<=in;
+ endmethod
+ endinterface;
+ interface gpio_in = interface Get#
+ method ActionValue#(Vector#({0},Bit#(1))) get;
+ return tget;
+ endmethod
+ endinterface;
+""".format(len(self.pinspecs))
+ return '\n' + tdecl + res + '\n' + template + '\n'
+
+ def ifacedef2pin(self, pin):
+ decfn = self.ifacefmtdecfn2
+ outfn = self.ifacefmtoutfn
+ # print pin, pin.outenmode
+ if pin.outenmode:
+ decfn = self.ifacefmtdecfn3
+ outfn = self.ifacefmtoutenfn
+ return pin.ifacedef3(outfn, self.ifacefmtinfn,
+ decfn)
+