Line 46... |
Line 46... |
|
|
module tb();
|
module tb();
|
|
|
`include "debug_functions.v"
|
`include "debug_functions.v"
|
`include "system_functions.v"
|
`include "system_functions.v"
|
|
`include "memory_configuration.v"
|
|
|
reg sysrst;
|
reg sysrst;
|
`ifdef XILINX_VIRTEX6_FPGA
|
`ifdef XILINX_VIRTEX6_FPGA
|
reg clk_533mhz;
|
reg clk_533mhz;
|
`endif
|
`endif
|
Line 97... |
Line 98... |
`ifdef XILINX_SPARTAN6_FPGA
|
`ifdef XILINX_SPARTAN6_FPGA
|
wire mcb3_rzq;
|
wire mcb3_rzq;
|
wire mcb3_zio;
|
wire mcb3_zio;
|
`endif
|
`endif
|
|
|
tri1 md_pad_io;
|
tri1 md; // bi-directional phy config data
|
|
wire mdc; // phy config clock
|
|
|
wire uart0_cts;
|
wire uart0_cts;
|
wire uart0_rx;
|
wire uart0_rx;
|
wire uart0_rts;
|
wire uart0_rts;
|
wire uart0_tx;
|
wire uart0_tx;
|
|
|
|
wire [3:0] eth_mtxd;
|
|
wire eth_mtxdv;
|
|
wire eth_mtxerr;
|
|
wire [3:0] eth_mrxd;
|
|
wire eth_mrxdv;
|
|
|
|
|
|
|
// ======================================
|
// ======================================
|
// Instantiate FPGA
|
// Instantiate FPGA
|
// ======================================
|
// ======================================
|
system u_system (
|
system u_system (
|
Line 150... |
Line 159... |
.mcb3_zio ( mcb3_zio ),
|
.mcb3_zio ( mcb3_zio ),
|
`endif
|
`endif
|
|
|
// Ethernet MII signals
|
// Ethernet MII signals
|
.mtx_clk_pad_i ( clk_25mhz ),
|
.mtx_clk_pad_i ( clk_25mhz ),
|
.mtxd_pad_o ( ),
|
.mtxd_pad_o ( eth_mrxd ),
|
.mtxen_pad_o ( ),
|
.mtxen_pad_o ( eth_mrxdv ),
|
.mtxerr_pad_o ( ),
|
.mtxerr_pad_o ( ),
|
.mrx_clk_pad_i ( clk_25mhz ),
|
.mrx_clk_pad_i ( clk_25mhz ),
|
.mrxd_pad_i ( 4'd0 ),
|
.mrxd_pad_i ( eth_mtxd ),
|
.mrxdv_pad_i ( 1'd0 ),
|
.mrxdv_pad_i ( eth_mtxdv ),
|
.mrxerr_pad_i ( 1'd0 ),
|
.mrxerr_pad_i ( eth_mtxerr ),
|
.mcoll_pad_i ( 1'd0 ),
|
.mcoll_pad_i ( 1'd0 ),
|
.mcrs_pad_i ( 1'd0 ), // Assert Carrier Sense from PHY
|
.mcrs_pad_i ( 1'd0 ), // Assert Carrier Sense from PHY
|
.phy_reset_n ( ),
|
.phy_reset_n ( ),
|
|
|
// Ethernet MD signals
|
// Ethernet Management Data signals
|
.md_pad_io ( md_pad_io ),
|
.md_pad_io ( md ),
|
.mdc_pad_o ( )
|
.mdc_pad_o ( mdc ),
|
|
|
|
// LEDs
|
|
.led ( )
|
);
|
);
|
|
|
|
|
|
|
|
// ======================================
|
|
// Instantiate Ethernet Test Device
|
|
// ======================================
|
|
eth_test u_eth_test(
|
|
.md_io ( md ),
|
|
.mdc_i ( mdc ),
|
|
.mtx_clk_i ( clk_25mhz ),
|
|
.mtxd_o ( eth_mtxd ),
|
|
.mtxdv_o ( eth_mtxdv ),
|
|
.mtxerr_o ( eth_mtxerr ),
|
|
.mrxd_i ( eth_mrxd ),
|
|
.mrxdv_i ( eth_mrxdv )
|
|
);
|
|
|
|
|
|
|
// ======================================
|
// ======================================
|
// Instantiate DDR3 Memory Model
|
// Instantiate DDR3 Memory Model
|
// ======================================
|
// ======================================
|
`ifdef XILINX_FPGA
|
`ifdef XILINX_FPGA
|
ddr3_model_c3 #(
|
ddr3_model_c3 #(
|
Line 200... |
Line 228... |
.rst_n ( ddr3_reset_n )
|
.rst_n ( ddr3_reset_n )
|
);
|
);
|
`endif
|
`endif
|
|
|
|
|
|
|
// ======================================
|
// ======================================
|
// Instantiate Testbench UART
|
// Instantiate Testbench UART
|
// ======================================
|
// ======================================
|
tb_uart u_tb_uart (
|
tb_uart u_tb_uart (
|
.i_uart_cts_n ( uart0_cts ), // Clear To Send
|
.i_uart_cts_n ( uart0_cts ), // Clear To Send
|
Line 212... |
Line 241... |
.o_uart_txd ( uart0_tx )
|
.o_uart_txd ( uart0_tx )
|
|
|
);
|
);
|
|
|
|
|
|
|
// ======================================
|
// ======================================
|
// Global module for xilinx hardware simulations
|
// Global module for xilinx hardware simulations
|
// ======================================
|
// ======================================
|
`ifdef XILINX_FPGA
|
`ifdef XILINX_FPGA
|
`define GLBL
|
`define GLBL
|
Line 309... |
Line 339... |
begin
|
begin
|
boot_mem_file_address = hex_chars_to_32bits (aligned_line[119*8-1:111*8]);
|
boot_mem_file_address = hex_chars_to_32bits (aligned_line[119*8-1:111*8]);
|
boot_mem_file_data = hex_chars_to_32bits (aligned_line[110*8-1:102*8]);
|
boot_mem_file_data = hex_chars_to_32bits (aligned_line[110*8-1:102*8]);
|
|
|
`ifdef AMBER_A25_CORE
|
`ifdef AMBER_A25_CORE
|
boot_mem_file_data_128 = `U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:4]];
|
boot_mem_file_data_128 = `U_BOOT_MEM.u_mem.mem[boot_mem_file_address[BOOT_MSB:4]];
|
`U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:4]] =
|
`U_BOOT_MEM.u_mem.mem[boot_mem_file_address[BOOT_MSB:4]] =
|
insert_32_into_128 ( boot_mem_file_address[3:2],
|
insert_32_into_128 ( boot_mem_file_address[3:2],
|
boot_mem_file_data_128,
|
boot_mem_file_data_128,
|
boot_mem_file_data );
|
boot_mem_file_data );
|
`else
|
`else
|
`U_BOOT_MEM.u_mem.mem[boot_mem_file_address[12:2]] = boot_mem_file_data;
|
`U_BOOT_MEM.u_mem.mem[boot_mem_file_address[BOOT_MSB:2]] = boot_mem_file_data;
|
`endif
|
`endif
|
|
|
`ifdef AMBER_LOAD_MEM_DEBUG
|
`ifdef AMBER_LOAD_MEM_DEBUG
|
$display ("Load Boot Mem: PAddr: 0x%08x, Data 0x%08x",
|
$display ("Load Boot Mem: PAddr: 0x%08x, Data 0x%08x",
|
boot_mem_file_address, boot_mem_file_data);
|
boot_mem_file_address, boot_mem_file_data);
|