X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fperipherals%2Fi2c%2FI2C_top.bsv;h=0229502bdaa523e89bce12888a7c25719605aa39;hb=b204112136d9457fa593cf1b8c56360821155e25;hp=9b5977cc723f2871669f3ca2d11daa9f445cf3fe;hpb=821a48963171cf5a7cb3848a8d5203f933d16757;p=shakti-peripherals.git diff --git a/src/peripherals/i2c/I2C_top.bsv b/src/peripherals/i2c/I2C_top.bsv index 9b5977c..0229502 100644 --- a/src/peripherals/i2c/I2C_top.bsv +++ b/src/peripherals/i2c/I2C_top.bsv @@ -19,6 +19,7 @@ I2C Controller top module which is compliant with UM10204 I2C Specification prov // ================================================ package I2C_top; // Bluespec Libraries +import GetPut ::*; import TriState ::*; import Counter ::*; // ================================================ @@ -45,7 +46,6 @@ import Semi_FIFOF ::*; (*always_enabled, always_ready*) interface I2C_out; - method Bit#(1) scl_out; method Bit#(1) i2c_DRV0; method Bit#(1) i2c_DRV1; method Bit#(1) i2c_DRV2; @@ -55,11 +55,12 @@ import Semi_FIFOF ::*; method Bit#(1) i2c_PUQ; method Bit#(1) i2c_PWRUPZHL; method Bit#(1) i2c_PWRUP_PULL_EN; - method Action scl_in(Bit#(1) in); - method Bool scl_out_en; - method Bit#(1) sda_out; - method Action sda_in(Bit#(1) in); - method Bool sda_out_en; + interface Get#(Bit#(1)) scl_out; + interface Put#(Bit#(1)) scl_in; + interface Get#(Bit#(1)) scl_out_en; + interface Get#(Bit#(1)) sda_out; + interface Put#(Bit#(1)) sda_in; + interface Get#(Bit#(1)) sda_out_en; endinterface @@ -865,9 +866,6 @@ Interrupt Generation And Documentation endinterface*/ interface I2C_out out; - method Bit#(1) scl_out; - return val_SCL; - endmethod method Bit#(1) i2c_DRV0; return drv0_rg[0]; endmethod @@ -895,21 +893,36 @@ Interrupt Generation And Documentation method Bit#(1) i2c_PWRUP_PULL_EN; return pwrup_pull_en_rg[0]; endmethod - method Action scl_in(Bit#(1) in); + interface scl_out = interface Get + method ActionValue#(Bit#(1)) get; + return val_SCL; + endmethod + endinterface; + interface scl_in = interface Put + method Action put(Bit#(1) in); val_SCL_in <= in; - endmethod - method Bool scl_out_en; - return (cOutEn && eso == 1'b1); - endmethod - method Bit#(1) sda_out; + endmethod + endinterface; + interface scl_out_en = interface Get + method ActionValue#(Bit#(1)) get; + return pack(cOutEn && eso == 1'b1); + endmethod + endinterface; + interface sda_out = interface Get + method ActionValue#(Bit#(1)) get; return val_SDA; - endmethod - method Action sda_in(Bit#(1) in); + endmethod + endinterface; + interface sda_in = interface Put + method Action put(Bit#(1) in); val_SDA_in <= in; - endmethod - method Bool sda_out_en; - return (dOutEn && eso == 1'b1); - endmethod + endmethod + endinterface; + interface sda_out_en = interface Get + method ActionValue#(Bit#(1)) get; + return pack(dOutEn && eso == 1'b1); + endmethod + endinterface; endinterface //AXI-4 Interface