From: Luke Kenneth Casson Leighton Date: Wed, 1 Aug 2018 11:49:27 +0000 (+0100) Subject: convert sdram to get/put X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a30dd6bb25eea95e9175346f97b00f85a01e17a5;p=shakti-peripherals.git convert sdram to get/put --- diff --git a/src/peripherals/sdram/sdr_top.bsv b/src/peripherals/sdram/sdr_top.bsv index ec1d821..373fc9f 100644 --- a/src/peripherals/sdram/sdr_top.bsv +++ b/src/peripherals/sdram/sdr_top.bsv @@ -49,19 +49,20 @@ import FIFOF::*; import Clocks::*; interface Ifc_sdram_out; - (*always_enabled,always_ready*) - method Action ipad_sdr_din(Bit#(64) pad_sdr_din); - method Bit#(9) sdram_sdio_ctrl(); - method Bit#(64) osdr_dout(); - method Bit#(8) osdr_den_n(); - method Bool osdr_cke(); - method Bool osdr_cs_n(); - method Bool osdr_ras_n (); - method Bool osdr_cas_n (); - method Bool osdr_we_n (); - method Bit#(8) osdr_dqm (); - method Bit#(2) osdr_ba (); - method Bit#(13) osdr_addr (); + (*always_enabled, always_ready*) + interface Put#(Bit#(64)) ipad_sdr_din; + interface Get#(Bit#(64)) osdr_dout; + interface Get#(Bit#(64)) osdr_den_n; + interface Get#(Bit#(1)) osdr_cke; + interface Get#(Bit#(1)) osdr_cs_n; + interface Get#(Bit#(1)) osdr_ras_n; + interface Get#(Bit#(1)) osdr_cas_n; + interface Get#(Bit#(1)) osdr_we_n; + interface Get#(Bit#(8)) osdr_dqm; + interface Get#(Bit#(2)) osdr_ba; + interface Get#(Bit#(13)) osdr_addr; + + method Bit#(9) sdram_sdio_ctrl; interface Clock sdram_clk; endinterface @@ -759,51 +760,80 @@ module mksdr_axi4_slave#(Clock clk0) (Ifc_sdr_slave); interface Ifc_sdram_out ifc_sdram_out; - method Action ipad_sdr_din(Bit#(64) pad_sdr_din); - sdr_cntrl.ipad_sdr_din(pad_sdr_din); - endmethod - method Bit#(9) sdram_sdio_ctrl(); - return rg_cfg_sdio_ctrl; - endmethod - method Bit#(64) osdr_dout(); - return sdr_cntrl.osdr_dout(); - endmethod - method Bit#(8) osdr_den_n(); - return sdr_cntrl.osdr_den_n(); - endmethod - method Bool osdr_cke(); - return sdr_cntrl.osdr_cke(); - endmethod - - method Bool osdr_cs_n(); - return sdr_cntrl.osdr_cs_n(); - endmethod - - method Bool osdr_ras_n (); - return sdr_cntrl.osdr_ras_n; - endmethod - - method Bool osdr_cas_n (); - return sdr_cntrl.osdr_cas_n; - endmethod - - method Bool osdr_we_n (); - return sdr_cntrl.osdr_we_n; - endmethod + interface ipad_sdr_din = interface Put + method Action put(Bit#(64) in) + sdr_cntrl.ipad_sdr_din <= in; + endmethod + endinterface; - method Bit#(8) osdr_dqm (); + interface osdr_dout = interface Get + method ActionValue#(Bit#(64)) get; + return sdr_cntrl.osdr_dout(); + endmethod + endinterface; + + interface osdr_den_n = interface Get + method ActionValue#(Bit#(64)) get; + Bit#(64) temp; + for (int i=0; i<8; i=i+1) begin + temp[i*8] = sdr_cntrl.osdr_den_n[i]; + end + return temp; + endmethod + endinterface; + + interface osdr_cke = interface Get + method ActionValue#(Bit#(1)) get; + return pack(sdr_cntrl.osdr_cke()); + endmethod + endinterface; + + interface osdr_cs_n = interface Get + method ActionValue#(Bit#(1)) get; + return pack(sdr_cntrl.osdr_cs_n()); + endmethod + endinterface; + + interface osdr_ras_n = interface Get + method ActionValue#(Bit#(1)) get; + return pack(sdr_cntrl.osdr_ras_n); + endmethod + endinterface; + + interface osdr_cas_n = interface Get + method ActionValue#(Bit#(1)) get; + return pack(sdr_cntrl.osdr_cas_n); + endmethod + endinterface; + + interface osdr_we_n = interface Get + method ActionValue#(Bit#(1)) get; + return pack(sdr_cntrl.osdr_we_n); + endmethod + endinterface; + + interface osdr_dqm = interface Get + method ActionValue#(Bit#(8)) get; return sdr_cntrl.osdr_dqm; - endmethod + endmethod + endinterface; - method Bit#(2) osdr_ba (); + interface osdr_ba = interface Get + method ActionValue#(Bit#(2)) get; return sdr_cntrl.osdr_ba; - endmethod + endmethod + endinterface; - method Bit#(13) osdr_addr (); + interface osdr_addr = interface Get + method ActionValue#(Bit#(13)) get; return sdr_cntrl.osdr_addr; - endmethod - + endmethod + endinterface; + interface sdram_clk = clk0; + method Bit#(9) sdram_sdio_ctrl(); + return rg_cfg_sdio_ctrl; + endmethod endinterface