From: Luke Kenneth Casson Leighton Date: Sun, 29 Jul 2018 08:54:00 +0000 (+0100) Subject: add ifc_sync module X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=434854bab2f6b3643d06f645a76eb3641a4a7d36;p=shakti-peripherals.git add ifc_sync module --- diff --git a/src/lib/ifc_sync.bsv b/src/lib/ifc_sync.bsv new file mode 100644 index 0000000..b6878d7 --- /dev/null +++ b/src/lib/ifc_sync.bsv @@ -0,0 +1,32 @@ +package ifc_sync; + + import Clocks::*; + import GetPut::*; + + interface Ifc_sync#(type a); + interface Put#(a) put; + interface Get#(a) get; + endinterface + module mksyncconnection#(Clock putclock, Reset putreset, + Clock getclock, Reset getreset)(Ifc_sync#(a)) + provisos(Bits#(a, a__)); + CrossingReg#(a) null_wire<- mkNullCrossingReg(getclock,?, + clocked_by putclock, + reset_by putreset); + // ReadOnly#(Bit#(a)) null_wire <- mkNullCrossingWire(getclock, +// from_put, clocked_by getclock, +// reset_by getreset); + interface put = interface Put + method Action put(a in); + null_wire<= in; + endmethod + endinterface; + interface get = interface Get + method ActionValue#(a) get(); + return null_wire.crossed; + endmethod + endinterface; + endmodule + +endpackage; +