| 1 |
2 |
peteralieb |
// Top Module
|
| 2 |
|
|
|
| 3 |
|
|
module top
|
| 4 |
|
|
(
|
| 5 |
|
|
// MII Interface - EMAC0
|
| 6 |
|
|
MII_COL_0,
|
| 7 |
|
|
MII_CRS_0,
|
| 8 |
|
|
MII_TXD_0,
|
| 9 |
|
|
MII_TX_EN_0,
|
| 10 |
|
|
MII_TX_ER_0,
|
| 11 |
|
|
MII_TX_CLK_0,
|
| 12 |
|
|
MII_RXD_0,
|
| 13 |
|
|
MII_RX_DV_0,
|
| 14 |
|
|
MII_RX_ER_0,
|
| 15 |
|
|
MII_RX_CLK_0,
|
| 16 |
|
|
|
| 17 |
|
|
// Preserved Tie-Off Pins for EMAC0
|
| 18 |
|
|
//SPEED_VECTOR_IN_0,
|
| 19 |
|
|
HOSTCLK,
|
| 20 |
|
|
PHY_RESET_0,
|
| 21 |
|
|
// Asynchronous Reset
|
| 22 |
|
|
RESET
|
| 23 |
|
|
);
|
| 24 |
|
|
|
| 25 |
|
|
//-----------------------------------------------------------------------------
|
| 26 |
|
|
// Port Declarations
|
| 27 |
|
|
//-----------------------------------------------------------------------------
|
| 28 |
|
|
|
| 29 |
|
|
// MII Interface - EMAC0
|
| 30 |
|
|
input MII_COL_0;
|
| 31 |
|
|
input MII_CRS_0;
|
| 32 |
|
|
output [3:0] MII_TXD_0;
|
| 33 |
|
|
output MII_TX_EN_0;
|
| 34 |
|
|
output MII_TX_ER_0;
|
| 35 |
|
|
input MII_TX_CLK_0;
|
| 36 |
|
|
input [3:0] MII_RXD_0;
|
| 37 |
|
|
input MII_RX_DV_0;
|
| 38 |
|
|
input MII_RX_ER_0;
|
| 39 |
|
|
input MII_RX_CLK_0;
|
| 40 |
|
|
|
| 41 |
|
|
// Preserved Tie-Off Pins for EMAC0
|
| 42 |
|
|
//input [1:0] SPEED_VECTOR_IN_0;
|
| 43 |
|
|
input HOSTCLK;
|
| 44 |
|
|
output PHY_RESET_0;
|
| 45 |
|
|
|
| 46 |
|
|
// Asynchronous Reset
|
| 47 |
|
|
input RESET;
|
| 48 |
|
|
|
| 49 |
|
|
//-----------------------------------------------------------------------------
|
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
//-------------------------------------------------------------------------------------
|
| 53 |
|
|
//-------------------------------------------------------------------------------------
|
| 54 |
|
|
// User Signals
|
| 55 |
|
|
//-------------------------------------------------------------------------------------
|
| 56 |
|
|
//-------------------------------------------------------------------------------------
|
| 57 |
|
|
|
| 58 |
|
|
//reg [7:0] DIP_r;
|
| 59 |
|
|
wire reset_i_n, reset_i;
|
| 60 |
|
|
//reg [7:0] LEDr;
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
//-----------------------------------------------------------------------------
|
| 64 |
|
|
// Ethernet Platform Instance
|
| 65 |
|
|
//-----------------------------------------------------------------------------
|
| 66 |
|
|
|
| 67 |
|
|
wire in_src_rdy_usr;
|
| 68 |
|
|
wire out_dst_rdy_usr;
|
| 69 |
|
|
wire [7:0] in_data_usr;
|
| 70 |
|
|
wire in_sof_usr;
|
| 71 |
|
|
wire in_eof_usr;
|
| 72 |
|
|
wire in_dst_rdy_usr;
|
| 73 |
|
|
wire out_src_rdy_usr;
|
| 74 |
|
|
wire [7:0] out_data_usr;
|
| 75 |
|
|
wire out_sof_usr;
|
| 76 |
|
|
wire out_eof_usr;
|
| 77 |
|
|
wire [3:0] outport_usr;
|
| 78 |
|
|
wire [3:0] inport_usr;
|
| 79 |
|
|
wire clk_local;
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
|
|
enetplatform enet_inst
|
| 83 |
|
|
(
|
| 84 |
|
|
.MII_COL_0(MII_COL_0),
|
| 85 |
|
|
.MII_CRS_0(MII_CRS_0),
|
| 86 |
|
|
.MII_TXD_0(MII_TXD_0),
|
| 87 |
|
|
.MII_TX_EN_0(MII_TX_EN_0),
|
| 88 |
|
|
.MII_TX_ER_0(MII_TX_ER_0),
|
| 89 |
|
|
.MII_TX_CLK_0(MII_TX_CLK_0),
|
| 90 |
|
|
.MII_RXD_0(MII_RXD_0),
|
| 91 |
|
|
.MII_RX_DV_0(MII_RX_DV_0),
|
| 92 |
|
|
.MII_RX_ER_0(MII_RX_ER_0),
|
| 93 |
|
|
.MII_RX_CLK_0(MII_RX_CLK_0),
|
| 94 |
|
|
.HOSTCLK(HOSTCLK),
|
| 95 |
|
|
.PHY_RESET_0(PHY_RESET_0),
|
| 96 |
|
|
.RESET(reset_i),
|
| 97 |
|
|
.in_src_rdy_usr(in_src_rdy_usr),
|
| 98 |
|
|
.out_dst_rdy_usr(out_dst_rdy_usr),
|
| 99 |
|
|
.in_data_usr(in_data_usr),
|
| 100 |
|
|
.in_sof_usr(in_sof_usr),
|
| 101 |
|
|
.in_eof_usr(in_eof_usr),
|
| 102 |
|
|
.in_dst_rdy_usr(in_dst_rdy_usr),
|
| 103 |
|
|
.out_src_rdy_usr(out_src_rdy_usr),
|
| 104 |
|
|
.out_data_usr(out_data_usr),
|
| 105 |
|
|
.out_sof_usr(out_sof_usr),
|
| 106 |
|
|
.out_eof_usr(out_eof_usr),
|
| 107 |
|
|
.outport_usr(outport_usr),
|
| 108 |
|
|
.inport_usr(inport_usr),
|
| 109 |
|
|
.clk_local(clk_local)
|
| 110 |
|
|
);
|
| 111 |
|
|
|
| 112 |
|
|
//-------------------------------------------------------------------------------------
|
| 113 |
|
|
//-------------------------------------------------------------------------------------
|
| 114 |
|
|
|
| 115 |
|
|
IBUF reset_ibuf (.I(RESET), .O(reset_i_n));
|
| 116 |
|
|
assign reset_i = ~reset_i_n;
|
| 117 |
|
|
|
| 118 |
|
|
//-------------------------------------------------------------------------------------
|
| 119 |
|
|
//-------------------------------------------------------------------------------------
|
| 120 |
|
|
// ICAP Logic
|
| 121 |
|
|
//-------------------------------------------------------------------------------------
|
| 122 |
|
|
//-------------------------------------------------------------------------------------
|
| 123 |
|
|
|
| 124 |
|
|
wire icap_en_wr;
|
| 125 |
|
|
wire icap_en_rd;
|
| 126 |
|
|
wire icap_out_src_rdy;
|
| 127 |
|
|
wire icap_in_dst_rdy;
|
| 128 |
|
|
wire icap_sofout;
|
| 129 |
|
|
wire icap_eofout;
|
| 130 |
|
|
wire [7:0] icap_dataout;
|
| 131 |
|
|
|
| 132 |
|
|
port_icap_buf the_picap
|
| 133 |
|
|
(
|
| 134 |
|
|
.clk(clk_local),
|
| 135 |
|
|
.rst(reset_i),
|
| 136 |
|
|
.en_wr(icap_en_wr),
|
| 137 |
|
|
.en_rd(icap_en_rd),
|
| 138 |
|
|
.in_data(out_data_usr),
|
| 139 |
|
|
.in_sof(out_sof_usr),
|
| 140 |
|
|
.in_eof(out_eof_usr),
|
| 141 |
|
|
.in_src_rdy(out_src_rdy_usr),
|
| 142 |
|
|
.out_dst_rdy(in_dst_rdy_usr),
|
| 143 |
|
|
.out_data(icap_dataout),
|
| 144 |
|
|
.out_sof(icap_sofout),
|
| 145 |
|
|
.out_eof(icap_eofout),
|
| 146 |
|
|
.out_src_rdy(icap_out_src_rdy),
|
| 147 |
|
|
.in_dst_rdy(icap_in_dst_rdy)
|
| 148 |
|
|
);
|
| 149 |
|
|
|
| 150 |
|
|
assign icap_en_wr = ((outport_usr == 3 && out_src_rdy_usr == 1) || (inport_usr == 3 && in_dst_rdy_usr == 1)) ? 1 : 0;
|
| 151 |
|
|
assign icap_en_rd = ((outport_usr == 4 && out_src_rdy_usr == 1) || (inport_usr == 4 && in_dst_rdy_usr == 1)) ? 1 : 0;
|
| 152 |
|
|
assign in_src_rdy_usr = (inport_usr == 3 || inport_usr == 4) ? icap_out_src_rdy : 1;
|
| 153 |
|
|
assign out_dst_rdy_usr = (outport_usr == 3 || outport_usr == 4) ? icap_in_dst_rdy : 1;
|
| 154 |
|
|
assign in_sof_usr = (inport_usr == 3 || inport_usr == 4) ? icap_sofout : 1;
|
| 155 |
|
|
assign in_eof_usr = (inport_usr == 3 || inport_usr == 4) ? icap_eofout : 1;
|
| 156 |
|
|
assign in_data_usr = (inport_usr == 3 || inport_usr == 4) ? icap_dataout : 0;//DIP_r;
|
| 157 |
|
|
|
| 158 |
|
|
|
| 159 |
|
|
//-------------------------------------------------------------------------------------
|
| 160 |
|
|
//-------------------------------------------------------------------------------------
|
| 161 |
|
|
// User Logic
|
| 162 |
|
|
//-------------------------------------------------------------------------------------
|
| 163 |
|
|
//-------------------------------------------------------------------------------------
|
| 164 |
|
|
|
| 165 |
|
|
|
| 166 |
|
|
//assign LEDS = LEDr;
|
| 167 |
|
|
|
| 168 |
|
|
/*always @(posedge clk_local)
|
| 169 |
|
|
begin
|
| 170 |
|
|
DIP_r <= DIP;
|
| 171 |
|
|
end
|
| 172 |
|
|
|
| 173 |
|
|
always @(posedge clk_local)
|
| 174 |
|
|
begin
|
| 175 |
|
|
if (reset_cpu_p)
|
| 176 |
|
|
LEDr <= 0;
|
| 177 |
|
|
else if (outport_usr == 1 && out_src_rdy_usr == 1)
|
| 178 |
|
|
LEDr <= out_data_usr;
|
| 179 |
|
|
end*/
|
| 180 |
|
|
|
| 181 |
|
|
// LED Status
|
| 182 |
|
|
//moving_led pr_mod_inst (
|
| 183 |
|
|
// .clk(clk_local),
|
| 184 |
|
|
// .rst(reset_cpu_p),
|
| 185 |
|
|
// .leds(LEDS)
|
| 186 |
|
|
//);
|
| 187 |
|
|
|
| 188 |
|
|
endmodule
|