2014-12-14 22:19:02 -05:00
|
|
|
module elink(/*AUTOARG*/
|
2014-12-14 17:25:46 -05:00
|
|
|
// Outputs
|
2015-05-14 22:26:05 -04:00
|
|
|
rx_lclk_pll, rxo_wr_wait_p, rxo_wr_wait_n, rxo_rd_wait_p,
|
2015-05-13 23:29:18 -04:00
|
|
|
rxo_rd_wait_n, txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n,
|
2015-06-25 16:09:05 -04:00
|
|
|
txo_data_p, txo_data_n, e_chipid, elink_en, rxwr_access,
|
|
|
|
rxwr_packet, rxrd_access, rxrd_packet, rxrr_access, rxrr_packet,
|
|
|
|
txwr_wait, txrd_wait, txrr_wait, mailbox_not_empty, mailbox_full,
|
|
|
|
timeout,
|
2014-12-14 17:25:46 -05:00
|
|
|
// Inputs
|
2015-05-14 22:26:05 -04:00
|
|
|
reset, sys_clk, tx_lclk, tx_lclk90, tx_lclk_div4, rx_lclk,
|
2015-08-24 21:08:49 +02:00
|
|
|
rx_lclk_div4, rxi_lclk_p, rxi_lclk_n, rxi_frame_p,
|
2015-05-14 22:26:05 -04:00
|
|
|
rxi_frame_n, rxi_data_p, rxi_data_n, txi_wr_wait_p, txi_wr_wait_n,
|
2015-05-13 23:29:18 -04:00
|
|
|
txi_rd_wait_p, txi_rd_wait_n, rxwr_wait, rxrd_wait, rxrr_wait,
|
|
|
|
txwr_access, txwr_packet, txrd_access, txrd_packet, txrr_access,
|
|
|
|
txrr_packet
|
2014-12-14 17:25:46 -05:00
|
|
|
);
|
2015-04-15 11:54:43 -04:00
|
|
|
|
2015-07-02 16:55:42 -04:00
|
|
|
parameter AW = 32; //native address width
|
|
|
|
parameter DW = 32; //native data width
|
2015-04-23 18:08:20 -04:00
|
|
|
parameter PW = 104; //packet width
|
2015-07-02 16:55:42 -04:00
|
|
|
parameter ID = 12'h810; //epiphany ID for elink (ie addr[31:20])
|
2015-06-30 13:32:05 +02:00
|
|
|
parameter IOSTD_ELINK = "LVDS_25";
|
2015-04-17 22:10:14 -04:00
|
|
|
|
2014-12-14 17:25:46 -05:00
|
|
|
/****************************/
|
2015-07-02 16:55:42 -04:00
|
|
|
/*CLOCK AND RESET */
|
2014-12-14 17:25:46 -05:00
|
|
|
/****************************/
|
2015-07-02 16:55:42 -04:00
|
|
|
input reset; // hardware reset
|
|
|
|
input sys_clk; // a single system clock for master/slave FIFOs
|
|
|
|
input tx_lclk; // fast tx clock for IO
|
|
|
|
input tx_lclk90; // fast 90deg shifted lclk
|
|
|
|
input tx_lclk_div4; // slow tx clock for core logic
|
|
|
|
input rx_lclk; // rx input clock tweaked by pll for IO
|
|
|
|
input rx_lclk_div4; // slow clock for rx logic
|
|
|
|
output rx_lclk_pll; // rx_lclk pass through input for pll
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2015-04-11 00:04:18 -04:00
|
|
|
/********************************/
|
2015-07-02 16:55:42 -04:00
|
|
|
/*ELINK RECEIVER */
|
2015-04-11 00:04:18 -04:00
|
|
|
/********************************/
|
2015-05-13 23:29:18 -04:00
|
|
|
input rxi_lclk_p, rxi_lclk_n; // rx clock input
|
|
|
|
input rxi_frame_p, rxi_frame_n; // rx frame signal
|
|
|
|
input [7:0] rxi_data_p, rxi_data_n; // rx data
|
|
|
|
output rxo_wr_wait_p,rxo_wr_wait_n; // rx write pushback output
|
|
|
|
output rxo_rd_wait_p,rxo_rd_wait_n; // rx read pushback output
|
2015-07-02 16:55:42 -04:00
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/*ELINK TRANSMITTER */
|
|
|
|
/********************************/
|
2015-05-13 23:29:18 -04:00
|
|
|
output txo_lclk_p, txo_lclk_n; // tx clock output
|
|
|
|
output txo_frame_p, txo_frame_n; // tx frame signal
|
|
|
|
output [7:0] txo_data_p, txo_data_n; // tx data
|
|
|
|
input txi_wr_wait_p,txi_wr_wait_n; // tx write pushback input
|
|
|
|
input txi_rd_wait_p,txi_rd_wait_n; // tx read pushback input
|
2014-12-14 17:25:46 -05:00
|
|
|
|
2015-07-02 16:55:42 -04:00
|
|
|
/*************************************/
|
|
|
|
/*EPIPHANY MISC INTERFACE (I/O PINS) */
|
|
|
|
/*************************************/
|
|
|
|
output [11:0] e_chipid; // chip id strap pins for epiphany
|
|
|
|
output elink_en; // master enable (reset) for elink/epiphany
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2015-04-11 00:04:18 -04:00
|
|
|
/*****************************/
|
2015-07-02 16:55:42 -04:00
|
|
|
/*MAILBOX INTERRUPTS */
|
|
|
|
/*****************************/
|
|
|
|
output mailbox_not_empty;
|
|
|
|
output mailbox_full;
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/*READBACK TIMEOUT (TBD) */
|
|
|
|
/*****************************/
|
|
|
|
output timeout;
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/*SYSTEM SIDE INTERFACE */
|
2015-04-29 11:55:01 -04:00
|
|
|
/*****************************/
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2015-04-23 18:08:20 -04:00
|
|
|
//Master Write (from RX)
|
|
|
|
output rxwr_access;
|
|
|
|
output [PW-1:0] rxwr_packet;
|
|
|
|
input rxwr_wait;
|
|
|
|
|
|
|
|
//Master Read Request (from RX)
|
|
|
|
output rxrd_access;
|
|
|
|
output [PW-1:0] rxrd_packet;
|
|
|
|
input rxrd_wait;
|
|
|
|
|
|
|
|
//Slave Read Response (from RX)
|
|
|
|
output rxrr_access;
|
|
|
|
output [PW-1:0] rxrr_packet;
|
|
|
|
input rxrr_wait;
|
2015-05-13 23:29:18 -04:00
|
|
|
|
2015-04-23 18:08:20 -04:00
|
|
|
//Slave Write (to TX)
|
|
|
|
input txwr_access;
|
|
|
|
input [PW-1:0] txwr_packet;
|
|
|
|
output txwr_wait;
|
|
|
|
|
|
|
|
//Slave Read Request (to TX)
|
|
|
|
input txrd_access;
|
|
|
|
input [PW-1:0] txrd_packet;
|
|
|
|
output txrd_wait;
|
|
|
|
|
|
|
|
//Master Read Response (to TX)
|
|
|
|
input txrr_access;
|
|
|
|
input [PW-1:0] txrr_packet;
|
|
|
|
output txrr_wait;
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2015-04-11 00:04:18 -04:00
|
|
|
/*#############################################*/
|
|
|
|
/* END OF BLOCK INTERFACE */
|
|
|
|
/*#############################################*/
|
|
|
|
|
|
|
|
/*AUTOINPUT*/
|
2015-05-06 12:23:15 -04:00
|
|
|
|
2015-05-14 22:26:05 -04:00
|
|
|
//wire
|
|
|
|
wire erx_cfg_access; // To erx of erx.v
|
|
|
|
wire [PW-1:0] erx_cfg_packet; // To erx of erx.v
|
|
|
|
wire etx_cfg_wait; // To etx of etx.v
|
|
|
|
wire [31:0] mi_rd_data;
|
|
|
|
wire [31:0] mi_dout_ecfg;
|
|
|
|
wire [31:0] mi_dout_embox;
|
2015-04-15 11:54:43 -04:00
|
|
|
|
2014-12-14 17:25:46 -05:00
|
|
|
/*AUTOWIRE*/
|
|
|
|
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
2015-05-14 22:26:05 -04:00
|
|
|
wire [15:0] clk_config; // From ecfg_elink of ecfg_elink.v
|
2015-05-01 17:58:16 -04:00
|
|
|
wire erx_cfg_wait; // From erx of erx.v
|
2015-05-14 22:26:05 -04:00
|
|
|
wire erx_reset; // From ereset of ereset.v
|
2015-05-01 17:58:16 -04:00
|
|
|
wire etx_cfg_access; // From etx of etx.v
|
|
|
|
wire [PW-1:0] etx_cfg_packet; // From etx of etx.v
|
2015-05-14 22:26:05 -04:00
|
|
|
wire etx_reset; // From ereset of ereset.v
|
|
|
|
wire sys_reset; // From ereset of ereset.v
|
|
|
|
wire txwr_gated_access; // From ecfg_elink of ecfg_elink.v
|
2014-12-14 17:25:46 -05:00
|
|
|
// End of automatics
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2014-12-14 17:25:46 -05:00
|
|
|
/***********************************************************/
|
2015-05-01 17:58:16 -04:00
|
|
|
/*CLOCK AND RESET CONFIG */
|
2014-12-14 17:25:46 -05:00
|
|
|
/***********************************************************/
|
2015-05-02 22:40:27 -04:00
|
|
|
|
2015-05-14 22:26:05 -04:00
|
|
|
defparam ecfg_elink.ID=ID;
|
2015-05-02 22:40:27 -04:00
|
|
|
|
2015-05-14 22:26:05 -04:00
|
|
|
ecfg_elink ecfg_elink (.clk (sys_clk),
|
|
|
|
/*AUTOINST*/
|
|
|
|
// Outputs
|
|
|
|
.txwr_gated_access (txwr_gated_access),
|
|
|
|
.elink_en (elink_en),
|
|
|
|
.clk_config (clk_config[15:0]),
|
2015-06-25 16:09:05 -04:00
|
|
|
.e_chipid (e_chipid[11:0]),
|
2015-05-14 22:26:05 -04:00
|
|
|
// Inputs
|
|
|
|
.txwr_access (txwr_access),
|
|
|
|
.txwr_packet (txwr_packet[PW-1:0]),
|
|
|
|
.reset (reset));
|
2015-04-23 23:11:58 -04:00
|
|
|
|
2015-04-23 18:08:20 -04:00
|
|
|
/***********************************************************/
|
|
|
|
/*RESET CIRCUITRY */
|
|
|
|
/***********************************************************/
|
2015-05-13 23:29:18 -04:00
|
|
|
//Synchronize with each clock domain
|
|
|
|
|
2015-05-14 22:26:05 -04:00
|
|
|
ereset ereset (
|
2015-05-01 17:58:16 -04:00
|
|
|
/*AUTOINST*/
|
2015-04-23 18:08:20 -04:00
|
|
|
// Outputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.etx_reset (etx_reset),
|
|
|
|
.erx_reset (erx_reset),
|
|
|
|
.sys_reset (sys_reset),
|
2015-04-23 18:08:20 -04:00
|
|
|
// Inputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.reset (reset),
|
|
|
|
.sys_clk (sys_clk),
|
|
|
|
.tx_lclk_div4 (tx_lclk_div4),
|
|
|
|
.rx_lclk_div4 (rx_lclk_div4));
|
2014-12-14 17:25:46 -05:00
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
/*RECEIVER */
|
|
|
|
/***********************************************************/
|
2015-04-11 00:04:18 -04:00
|
|
|
/*erx AUTO_TEMPLATE (
|
2015-04-24 17:39:05 -04:00
|
|
|
.mi_dout (mi_rx_dout[]),
|
2015-05-14 22:26:05 -04:00
|
|
|
.reset (erx_reset),
|
2015-05-01 17:58:16 -04:00
|
|
|
);
|
2015-04-11 00:04:18 -04:00
|
|
|
*/
|
|
|
|
|
2015-04-27 23:51:00 -04:00
|
|
|
defparam erx.ID=ID;
|
2015-06-30 13:32:05 +02:00
|
|
|
defparam erx.IOSTD_ELINK=IOSTD_ELINK;
|
2015-04-11 00:04:18 -04:00
|
|
|
erx erx(
|
2014-12-14 17:25:46 -05:00
|
|
|
/*AUTOINST*/
|
|
|
|
// Outputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.rx_lclk_pll (rx_lclk_pll),
|
2015-04-13 23:35:21 -04:00
|
|
|
.rxo_wr_wait_p (rxo_wr_wait_p),
|
|
|
|
.rxo_wr_wait_n (rxo_wr_wait_n),
|
|
|
|
.rxo_rd_wait_p (rxo_rd_wait_p),
|
|
|
|
.rxo_rd_wait_n (rxo_rd_wait_n),
|
2015-04-23 18:08:20 -04:00
|
|
|
.rxwr_access (rxwr_access),
|
|
|
|
.rxwr_packet (rxwr_packet[PW-1:0]),
|
|
|
|
.rxrd_access (rxrd_access),
|
|
|
|
.rxrd_packet (rxrd_packet[PW-1:0]),
|
|
|
|
.rxrr_access (rxrr_access),
|
|
|
|
.rxrr_packet (rxrr_packet[PW-1:0]),
|
2015-05-01 17:58:16 -04:00
|
|
|
.erx_cfg_wait (erx_cfg_wait),
|
2015-04-27 15:11:56 -04:00
|
|
|
.timeout (timeout),
|
2015-05-01 17:58:16 -04:00
|
|
|
.mailbox_full (mailbox_full),
|
|
|
|
.mailbox_not_empty (mailbox_not_empty),
|
2014-12-14 17:25:46 -05:00
|
|
|
// Inputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.erx_reset (erx_reset),
|
|
|
|
.sys_reset (sys_reset),
|
2015-05-01 17:58:16 -04:00
|
|
|
.sys_clk (sys_clk),
|
2015-05-13 23:29:18 -04:00
|
|
|
.rx_lclk (rx_lclk),
|
|
|
|
.rx_lclk_div4 (rx_lclk_div4),
|
2015-04-13 23:35:21 -04:00
|
|
|
.rxi_lclk_p (rxi_lclk_p),
|
|
|
|
.rxi_lclk_n (rxi_lclk_n),
|
|
|
|
.rxi_frame_p (rxi_frame_p),
|
|
|
|
.rxi_frame_n (rxi_frame_n),
|
|
|
|
.rxi_data_p (rxi_data_p[7:0]),
|
2015-04-23 18:08:20 -04:00
|
|
|
.rxi_data_n (rxi_data_n[7:0]),
|
|
|
|
.rxwr_wait (rxwr_wait),
|
|
|
|
.rxrd_wait (rxrd_wait),
|
|
|
|
.rxrr_wait (rxrr_wait),
|
2015-05-01 17:58:16 -04:00
|
|
|
.erx_cfg_access (erx_cfg_access),
|
|
|
|
.erx_cfg_packet (erx_cfg_packet[PW-1:0]));
|
2014-12-14 17:25:46 -05:00
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
/*TRANSMITTER */
|
|
|
|
/***********************************************************/
|
2015-04-24 17:39:05 -04:00
|
|
|
/*etx AUTO_TEMPLATE (.mi_dout (mi_tx_dout[]),
|
2015-04-13 23:35:21 -04:00
|
|
|
.emwr_\(.*\) (esaxi_emwr_\1[]),
|
|
|
|
.emrq_\(.*\) (esaxi_emrq_\1[]),
|
|
|
|
.emrr_\(.*\) (emaxi_emrr_\1[]),
|
2015-05-14 22:26:05 -04:00
|
|
|
.reset (etx_reset),
|
2015-05-04 10:49:17 -04:00
|
|
|
|
2015-04-13 23:35:21 -04:00
|
|
|
);
|
2015-04-11 00:04:18 -04:00
|
|
|
*/
|
2015-04-23 23:11:58 -04:00
|
|
|
|
2015-04-27 23:51:00 -04:00
|
|
|
defparam etx.ID=ID;
|
2015-06-30 13:32:05 +02:00
|
|
|
defparam etx.IOSTD_ELINK=IOSTD_ELINK;
|
2015-05-04 10:49:17 -04:00
|
|
|
etx etx(.txwr_access (txwr_gated_access),
|
2015-04-11 00:04:18 -04:00
|
|
|
/*AUTOINST*/
|
2014-12-14 17:25:46 -05:00
|
|
|
// Outputs
|
2015-04-13 23:35:21 -04:00
|
|
|
.txo_lclk_p (txo_lclk_p),
|
|
|
|
.txo_lclk_n (txo_lclk_n),
|
|
|
|
.txo_frame_p (txo_frame_p),
|
|
|
|
.txo_frame_n (txo_frame_n),
|
|
|
|
.txo_data_p (txo_data_p[7:0]),
|
|
|
|
.txo_data_n (txo_data_n[7:0]),
|
2015-05-01 17:58:16 -04:00
|
|
|
.txrd_wait (txrd_wait),
|
|
|
|
.txwr_wait (txwr_wait),
|
|
|
|
.txrr_wait (txrr_wait),
|
|
|
|
.etx_cfg_access (etx_cfg_access),
|
|
|
|
.etx_cfg_packet (etx_cfg_packet[PW-1:0]),
|
2014-12-14 17:25:46 -05:00
|
|
|
// Inputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.etx_reset (etx_reset),
|
|
|
|
.sys_reset (sys_reset),
|
2015-05-01 17:58:16 -04:00
|
|
|
.sys_clk (sys_clk),
|
2015-03-25 19:25:12 -04:00
|
|
|
.tx_lclk (tx_lclk),
|
2015-04-22 15:03:24 -04:00
|
|
|
.tx_lclk90 (tx_lclk90),
|
|
|
|
.tx_lclk_div4 (tx_lclk_div4),
|
2015-05-01 17:58:16 -04:00
|
|
|
.txi_wr_wait_p (txi_wr_wait_p),
|
|
|
|
.txi_wr_wait_n (txi_wr_wait_n),
|
|
|
|
.txi_rd_wait_p (txi_rd_wait_p),
|
|
|
|
.txi_rd_wait_n (txi_rd_wait_n),
|
2015-04-23 18:08:20 -04:00
|
|
|
.txrd_access (txrd_access),
|
|
|
|
.txrd_packet (txrd_packet[PW-1:0]),
|
|
|
|
.txwr_packet (txwr_packet[PW-1:0]),
|
|
|
|
.txrr_access (txrr_access),
|
|
|
|
.txrr_packet (txrr_packet[PW-1:0]),
|
2015-05-01 17:58:16 -04:00
|
|
|
.etx_cfg_wait (etx_cfg_wait));
|
|
|
|
|
|
|
|
/***********************************************************/
|
|
|
|
/*TX-->RX REGISTER INTERFACE CONNECTION */
|
|
|
|
/***********************************************************/
|
2015-07-02 16:55:42 -04:00
|
|
|
defparam ecfg_cdc.DW=104;
|
2015-05-07 23:45:36 -04:00
|
|
|
defparam ecfg_cdc.DEPTH=16;
|
|
|
|
|
2015-05-14 22:26:05 -04:00
|
|
|
fifo_cdc ecfg_cdc (// Outputs
|
|
|
|
.wait_out (etx_cfg_wait),
|
|
|
|
.access_out (erx_cfg_access),
|
|
|
|
.packet_out (erx_cfg_packet[PW-1:0]),
|
2015-05-07 23:45:36 -04:00
|
|
|
// Inputs
|
2015-05-14 22:26:05 -04:00
|
|
|
.clk_in (tx_lclk_div4),
|
|
|
|
.reset_in (etx_reset),
|
|
|
|
.access_in (etx_cfg_access),
|
|
|
|
.packet_in (etx_cfg_packet[PW-1:0]),
|
|
|
|
.clk_out (rx_lclk_div4),
|
|
|
|
.reset_out (erx_reset),
|
|
|
|
.wait_in (erx_cfg_wait)
|
|
|
|
);
|
2015-05-01 17:58:16 -04:00
|
|
|
|
2015-04-11 00:04:18 -04:00
|
|
|
|
2014-12-14 17:25:46 -05:00
|
|
|
endmodule // elink
|
|
|
|
// Local Variables:
|
2015-05-01 17:58:16 -04:00
|
|
|
// verilog-library-directories:("." "../../erx/hdl" "../../etx/hdl" "../../memory/hdl")
|
2014-12-14 17:25:46 -05:00
|
|
|
// End:
|
|
|
|
|
2015-04-11 00:04:18 -04:00
|
|
|
/*
|
2015-08-07 09:19:37 -04:00
|
|
|
Copyright (C) 2015 Adapteva, Inc.
|
2015-04-11 00:04:18 -04:00
|
|
|
|
|
|
|
Contributed by Andreas Olofsson <andreas@adapteva.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.This program is distributed in the hope
|
|
|
|
that it will be useful,but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details. You should have received a copy
|
|
|
|
of the GNU General Public License along with this program (see the file
|
|
|
|
COPYING). If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|