// ================================================
package I2C_top;
// Bluespec Libraries
+import GetPut ::*;
import TriState ::*;
import Counter ::*;
// ================================================
(*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;
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
endinterface*/
interface I2C_out out;
- method Bit#(1) scl_out;
- return val_SCL;
- endmethod
method Bit#(1) i2c_DRV0;
return drv0_rg[0];
endmethod
method Bit#(1) i2c_PWRUP_PULL_EN;
return pwrup_pull_en_rg[0];
endmethod
- method Action scl_in(Bit#(1) in);
- val_SCL_in <= in;
- endmethod
- method Bool scl_out_en;
- return (cOutEn && eso == 1'b1);
+ interface scl_out = interface Get
+ method ActionValue#(Bit#(1)) get;
+ return val_SCL;
endmethod
- method Bit#(1) sda_out;
+ interface scl_in = interface Put
+ method Action put(Bit#(1) in);
+ val_SCL_in <= in;
+ 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);
+ 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