1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/mio/hdl/mtx_io.v

74 lines
2.0 KiB
Coq
Raw Normal View History

2016-02-24 20:29:56 -05:00
//#######################################################
//# Target specific IO logic (fast, timing sensitive)
//#######################################################
2016-02-26 22:51:35 -05:00
module mtx_io (/*AUTOARG*/
2016-02-24 20:29:56 -05:00
// Outputs
tx_packet, tx_access,
// Inputs
nreset, clk, io_access, io_packet, tx_wait
);
//#####################################################################
//# INTERFACE
//#####################################################################
//parameters
2016-02-26 22:51:35 -05:00
parameter MIOW = 16;
2016-02-24 20:29:56 -05:00
//RESET
input nreset; // async active low reset
input clk; // clock from divider
//Core side
input io_access; // valid packet
2016-02-26 22:51:35 -05:00
input [2*MIOW-1:0] io_packet; // packet
2016-02-24 20:29:56 -05:00
//IO interface
2016-02-26 22:51:35 -05:00
output [MIOW-1:0] tx_packet; // data for IO
2016-02-24 20:29:56 -05:00
output tx_access; // access signal for IO
input tx_wait; // pushback from IO
//regs
2016-02-26 22:51:35 -05:00
reg [2*MIOW-1:0] packet_reg;
reg [MIOW-1:0] packet_sh;
2016-02-24 20:29:56 -05:00
reg tx_access;
//########################################
//# RESET
//########################################
//synchronize reset to rx_clk
oh_rsync oh_rsync(.nrst_out (io_nreset),
.clk (clk),
.nrst_in (nreset));
//########################################
//# ACCESS (SDR)
//########################################
always @ (posedge clk or negedge io_nreset)
if(!io_nreset)
tx_access <= 1'b0;
else if(~tx_wait)
tx_access <= io_access;
//########################################
//# DATA (DDR)
//########################################
2016-02-26 22:51:35 -05:00
oh_oddr#(.DW(MIOW))
data_oddr (.out (tx_packet[MIOW-1:0]),
2016-02-24 20:29:56 -05:00
.clk (clk),
.ce (io_access & ~tx_wait),
2016-02-26 22:51:35 -05:00
.din1 (io_packet[MIOW-1:0]),
.din2 (io_packet[2*MIOW-1:MIOW])
2016-02-24 20:29:56 -05:00
);
2016-02-26 22:51:35 -05:00
endmodule // mtx_io
2016-02-24 20:29:56 -05:00
// Local Variables:
// verilog-library-directories:("." "../../common/hdl")
// End: