2016-02-26 22:51:35 -05:00
|
|
|
module mio (/*AUTOARG*/
|
2016-02-24 20:29:56 -05:00
|
|
|
// Outputs
|
2016-02-26 22:51:35 -05:00
|
|
|
tx_access, tx_packet, rx_wait, wait_out, access_out, packet_out,
|
2016-02-24 20:29:56 -05:00
|
|
|
// Inputs
|
2016-02-26 22:51:35 -05:00
|
|
|
clk, io_clk, nreset, datasize, tx_wait, rx_clk, rx_access,
|
|
|
|
rx_packet, access_in, packet_in, wait_in
|
2016-02-24 20:29:56 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
//#####################################################################
|
|
|
|
//# INTERFACE
|
|
|
|
//#####################################################################
|
|
|
|
|
|
|
|
//parameters
|
2016-02-26 22:51:35 -05:00
|
|
|
parameter PW = `CFG_MIOPW; // data width (core)
|
|
|
|
parameter MIOW = `CFG_MIOW; // Mini IO width
|
|
|
|
localparam CW = $clog2(2*PW/MIOW);// transfer count width
|
2016-02-24 20:29:56 -05:00
|
|
|
|
2016-02-26 22:51:35 -05:00
|
|
|
|
2016-02-24 20:29:56 -05:00
|
|
|
// reset, clk
|
|
|
|
input clk; // main core clock
|
|
|
|
input io_clk; // clock for TX
|
|
|
|
input nreset; // async active low reset
|
2016-02-26 22:51:35 -05:00
|
|
|
input [CW-1:0] datasize; // size of data transmitted
|
2016-02-24 20:29:56 -05:00
|
|
|
|
|
|
|
// tx interface
|
|
|
|
output tx_access; // access signal for IO
|
2016-02-26 22:51:35 -05:00
|
|
|
output [MIOW-1:0] tx_packet; // packet for IO
|
2016-02-24 20:29:56 -05:00
|
|
|
input tx_wait; // pushback from IO
|
|
|
|
|
|
|
|
// rx interface
|
|
|
|
input rx_clk; // rx clock
|
|
|
|
input rx_access; // rx access
|
2016-02-26 22:51:35 -05:00
|
|
|
input [MIOW-1:0] rx_packet; // rx packet
|
2016-02-24 20:29:56 -05:00
|
|
|
output rx_wait; // pushback from IO
|
|
|
|
|
2016-02-26 22:51:35 -05:00
|
|
|
// core interface
|
|
|
|
input access_in; // fifo data valid
|
|
|
|
input [PW-1:0] packet_in; // fifo packet
|
|
|
|
output wait_out; // wait pushback for fifo
|
2016-02-24 20:29:56 -05:00
|
|
|
output access_out; // fifo data valid
|
|
|
|
output [PW-1:0] packet_out; // fifo packet
|
|
|
|
input wait_in; // wait pushback for fifo
|
|
|
|
|
|
|
|
/*AUTOOUTPUT*/
|
|
|
|
/*AUTOINPUT*/
|
|
|
|
/*AUTOWIRE*/
|
|
|
|
|
2016-02-26 22:51:35 -05:00
|
|
|
mtx #(.MIOW(MIOW),
|
2016-02-24 20:29:56 -05:00
|
|
|
.PW(PW))
|
2016-02-26 22:51:35 -05:00
|
|
|
mtx (/*AUTOINST*/
|
2016-02-24 20:29:56 -05:00
|
|
|
// Outputs
|
|
|
|
.wait_out (wait_out),
|
|
|
|
.tx_access (tx_access),
|
2016-02-26 22:51:35 -05:00
|
|
|
.tx_packet (tx_packet[MIOW-1:0]),
|
2016-02-24 20:29:56 -05:00
|
|
|
// Inputs
|
|
|
|
.clk (clk),
|
|
|
|
.io_clk (io_clk),
|
|
|
|
.nreset (nreset),
|
|
|
|
.access_in (access_in),
|
|
|
|
.packet_in (packet_in[PW-1:0]),
|
|
|
|
.datasize (datasize[CW-1:0]),
|
|
|
|
.tx_wait (tx_wait));
|
|
|
|
|
2016-02-26 22:51:35 -05:00
|
|
|
mrx #(.MIOW(MIOW),
|
2016-02-24 20:29:56 -05:00
|
|
|
.PW(PW))
|
2016-02-26 22:51:35 -05:00
|
|
|
mrx (/*AUTOINST*/
|
2016-02-24 20:29:56 -05:00
|
|
|
// Outputs
|
|
|
|
.rx_wait (rx_wait),
|
|
|
|
.access_out (access_out),
|
|
|
|
.packet_out (packet_out[PW-1:0]),
|
|
|
|
// Inputs
|
|
|
|
.clk (clk),
|
|
|
|
.nreset (nreset),
|
|
|
|
.datasize (datasize[CW-1:0]),
|
|
|
|
.rx_clk (rx_clk),
|
|
|
|
.rx_access (rx_access),
|
2016-02-26 22:51:35 -05:00
|
|
|
.rx_packet (rx_packet[MIOW-1:0]),
|
2016-02-24 20:29:56 -05:00
|
|
|
.wait_in (wait_in));
|
|
|
|
|
2016-02-26 22:51:35 -05:00
|
|
|
endmodule // mio
|
|
|
|
|
|
|
|
|