mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
Refactoring (methodology)
This commit is contained in:
parent
c1da2531e6
commit
becff479ca
@ -53,8 +53,7 @@ module etx_core(/*AUTOARG*/
|
|||||||
|
|
||||||
// End of automatics
|
// End of automatics
|
||||||
/*AUTOINPUT*/
|
/*AUTOINPUT*/
|
||||||
|
|
||||||
|
|
||||||
/*AUTOWIRE*/
|
/*AUTOWIRE*/
|
||||||
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
// Beginning of automatic wires (for undeclared instantiated-module outputs)
|
||||||
wire burst_enable; // From etx_cfg of etx_cfg.v
|
wire burst_enable; // From etx_cfg of etx_cfg.v
|
||||||
@ -85,42 +84,39 @@ module etx_core(/*AUTOARG*/
|
|||||||
wire tx_enable; // From etx_cfg of etx_cfg.v
|
wire tx_enable; // From etx_cfg of etx_cfg.v
|
||||||
// End of automatics
|
// End of automatics
|
||||||
|
|
||||||
/************************************************************/
|
//##################################################################
|
||||||
/*ELINK TRANSMIT ARBITER */
|
//# ARBITER (SELECT BETWEEN TX, RX, RR)
|
||||||
/*-arbitrates between the wr,rr, and rd packets */
|
//##################################################################
|
||||||
/* */
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
defparam etx_arbiter.ID=ID;
|
etx_arbiter #(.ID(ID))
|
||||||
etx_arbiter etx_arbiter (
|
etx_arbiter (
|
||||||
/*AUTOINST*/
|
/*AUTOINST*/
|
||||||
// Outputs
|
// Outputs
|
||||||
.txwr_wait (txwr_wait),
|
.txwr_wait (txwr_wait),
|
||||||
.txrd_wait (txrd_wait),
|
.txrd_wait (txrd_wait),
|
||||||
.txrr_wait (txrr_wait),
|
.txrr_wait (txrr_wait),
|
||||||
.etx_access (etx_access),
|
.etx_access (etx_access),
|
||||||
.etx_rr (etx_rr),
|
.etx_rr (etx_rr),
|
||||||
.etx_packet (etx_packet[PW-1:0]),
|
.etx_packet (etx_packet[PW-1:0]),
|
||||||
// Inputs
|
// Inputs
|
||||||
.clk (clk),
|
.clk (clk),
|
||||||
.nreset (nreset),
|
.nreset (nreset),
|
||||||
.txwr_access (txwr_access),
|
.txwr_access (txwr_access),
|
||||||
.txwr_packet (txwr_packet[PW-1:0]),
|
.txwr_packet (txwr_packet[PW-1:0]),
|
||||||
.txrd_access (txrd_access),
|
.txrd_access (txrd_access),
|
||||||
.txrd_packet (txrd_packet[PW-1:0]),
|
.txrd_packet (txrd_packet[PW-1:0]),
|
||||||
.txrr_access (txrr_access),
|
.txrr_access (txrr_access),
|
||||||
.txrr_packet (txrr_packet[PW-1:0]),
|
.txrr_packet (txrr_packet[PW-1:0]),
|
||||||
.etx_rd_wait (etx_rd_wait),
|
.etx_rd_wait (etx_rd_wait),
|
||||||
.etx_wr_wait (etx_wr_wait),
|
.etx_wr_wait (etx_wr_wait),
|
||||||
.etx_cfg_wait (etx_cfg_wait),
|
.etx_cfg_wait (etx_cfg_wait),
|
||||||
.ctrlmode_bypass (ctrlmode_bypass),
|
.ctrlmode_bypass (ctrlmode_bypass),
|
||||||
.ctrlmode (ctrlmode[3:0]));
|
.ctrlmode (ctrlmode[3:0]));
|
||||||
|
|
||||||
|
//##################################################################
|
||||||
/************************************************************/
|
//# REMAPPING DESTINATION ADDRESS
|
||||||
/* REMAPPING (SHIFT) DESTINATION ADDRESS */
|
//##################################################################
|
||||||
/************************************************************/
|
/*etx_remap AUTO_TEMPLATE (
|
||||||
/*etx_remap AUTO_TEMPLATE (
|
|
||||||
.emesh_\(.*\)_in (etx_\1[]),
|
.emesh_\(.*\)_in (etx_\1[]),
|
||||||
.emesh_\(.*\)_out (etx_remap_\1[]),
|
.emesh_\(.*\)_out (etx_remap_\1[]),
|
||||||
.remap_en (remap_enable),
|
.remap_en (remap_enable),
|
||||||
@ -143,10 +139,11 @@ module etx_core(/*AUTOARG*/
|
|||||||
.etx_rd_wait (etx_rd_wait),
|
.etx_rd_wait (etx_rd_wait),
|
||||||
.etx_wr_wait (etx_wr_wait));
|
.etx_wr_wait (etx_wr_wait));
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
//##################################################################
|
||||||
/* EMMU */
|
//# TABLE LOOKUP ADDRESS TRANSLATION
|
||||||
/************************************************************/
|
//##################################################################
|
||||||
|
|
||||||
/*emmu AUTO_TEMPLATE (
|
/*emmu AUTO_TEMPLATE (
|
||||||
.emesh_\(.*\)_in (etx_remap_\1[]),
|
.emesh_\(.*\)_in (etx_remap_\1[]),
|
||||||
.emesh_\(.*\)_out (emmu_\1[]),
|
.emesh_\(.*\)_out (emmu_\1[]),
|
||||||
@ -164,8 +161,6 @@ module etx_core(/*AUTOARG*/
|
|||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//TODO: Remove etx_rr, not needed?
|
|
||||||
|
|
||||||
emmu etx_mmu (
|
emmu etx_mmu (
|
||||||
/*AUTOINST*/
|
/*AUTOINST*/
|
||||||
// Outputs
|
// Outputs
|
||||||
@ -188,9 +183,10 @@ module etx_core(/*AUTOARG*/
|
|||||||
.emesh_wr_wait (etx_wr_wait)); // Templated
|
.emesh_wr_wait (etx_wr_wait)); // Templated
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
//##################################################################
|
||||||
/*ELINK PROTOCOL LOGIC */
|
//# ELINK PROTOCOL CONVERTER (104 bit-->64 bits)
|
||||||
/************************************************************/
|
//##################################################################
|
||||||
|
|
||||||
/*etx_protocol AUTO_TEMPLATE (
|
/*etx_protocol AUTO_TEMPLATE (
|
||||||
.etx_rd_wait (etx_rd_wait),
|
.etx_rd_wait (etx_rd_wait),
|
||||||
.etx_wr_wait (etx_wr_wait),
|
.etx_wr_wait (etx_wr_wait),
|
||||||
@ -198,33 +194,33 @@ module etx_core(/*AUTOARG*/
|
|||||||
.etx_wait (etx_wait),
|
.etx_wait (etx_wait),
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defparam etx_protocol.ID=ID;
|
etx_protocol #(.ID(ID))
|
||||||
etx_protocol etx_protocol (
|
etx_protocol (
|
||||||
/*AUTOINST*/
|
/*AUTOINST*/
|
||||||
// Outputs
|
// Outputs
|
||||||
.etx_rd_wait (etx_rd_wait), // Templated
|
.etx_rd_wait (etx_rd_wait), // Templated
|
||||||
.etx_wr_wait (etx_wr_wait), // Templated
|
.etx_wr_wait (etx_wr_wait), // Templated
|
||||||
.tx_burst (tx_burst),
|
.tx_burst (tx_burst),
|
||||||
.tx_access (tx_access),
|
.tx_access (tx_access),
|
||||||
.tx_data_slow (tx_data_slow[63:0]),
|
.tx_data_slow (tx_data_slow[63:0]),
|
||||||
.tx_frame_slow (tx_frame_slow[3:0]),
|
.tx_frame_slow (tx_frame_slow[3:0]),
|
||||||
// Inputs
|
// Inputs
|
||||||
.nreset (nreset),
|
.nreset (nreset),
|
||||||
.clk (clk),
|
.clk (clk),
|
||||||
.etx_access (emmu_access), // Templated
|
.etx_access (emmu_access), // Templated
|
||||||
.etx_packet (emmu_packet[PW-1:0]), // Templated
|
.etx_packet (emmu_packet[PW-1:0]), // Templated
|
||||||
.tx_enable (tx_enable),
|
.tx_enable (tx_enable),
|
||||||
.burst_enable (burst_enable),
|
.burst_enable (burst_enable),
|
||||||
.gpio_data (gpio_data[8:0]),
|
.gpio_data (gpio_data[8:0]),
|
||||||
.gpio_enable (gpio_enable),
|
.gpio_enable (gpio_enable),
|
||||||
.tx_rd_wait (tx_rd_wait),
|
.tx_rd_wait (tx_rd_wait),
|
||||||
.tx_wr_wait (tx_wr_wait));
|
.tx_wr_wait (tx_wr_wait));
|
||||||
|
|
||||||
|
//##################################################################
|
||||||
/************************************************************/
|
//# Register interface for TX (or forward to RX)
|
||||||
/* CONFIGURATOIN PACKET */
|
//##################################################################
|
||||||
/************************************************************/
|
|
||||||
/*ecfg_if AUTO_TEMPLATE (
|
/*ecfg_if AUTO_TEMPLATE (
|
||||||
.\(.*\)_in (etx_\1[]),
|
.\(.*\)_in (etx_\1[]),
|
||||||
.\(.*\)_out (etx_cfg_\1[]),
|
.\(.*\)_out (etx_cfg_\1[]),
|
||||||
@ -233,58 +229,53 @@ module etx_core(/*AUTOARG*/
|
|||||||
.wait_in (etx_cfg_wait),
|
.wait_in (etx_cfg_wait),
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ecfg_if #(.ID(ID),
|
||||||
|
.RX(0))
|
||||||
|
|
||||||
defparam etx_cfgif.RX = 0;
|
etx_cfgif (.mi_dout3 (64'b0),
|
||||||
defparam etx_cfgif.ID = ID;
|
.mi_dout1 (64'b0),
|
||||||
ecfg_if etx_cfgif (.mi_dout3 (64'b0),
|
.mi_dma_en (),
|
||||||
.mi_dout1 (64'b0),
|
/*AUTOINST*/
|
||||||
.mi_dma_en (),
|
// Outputs
|
||||||
/*AUTOINST*/
|
.mi_mmu_en (mi_mmu_en),
|
||||||
// Outputs
|
.mi_cfg_en (mi_cfg_en),
|
||||||
.mi_mmu_en (mi_mmu_en),
|
.mi_we (mi_we),
|
||||||
.mi_cfg_en (mi_cfg_en),
|
.mi_addr (mi_addr[14:0]),
|
||||||
.mi_we (mi_we),
|
.mi_din (mi_din[63:0]),
|
||||||
.mi_addr (mi_addr[14:0]),
|
.access_out (etx_cfg_access), // Templated
|
||||||
.mi_din (mi_din[63:0]),
|
.packet_out (etx_cfg_packet[PW-1:0]), // Templated
|
||||||
.access_out (etx_cfg_access), // Templated
|
// Inputs
|
||||||
.packet_out (etx_cfg_packet[PW-1:0]), // Templated
|
.clk (clk),
|
||||||
// Inputs
|
.nreset (nreset),
|
||||||
.clk (clk),
|
.access_in (etx_access), // Templated
|
||||||
.nreset (nreset),
|
.packet_in (etx_packet[PW-1:0]), // Templated
|
||||||
.access_in (etx_access), // Templated
|
.mi_dout0 ({32'b0,mi_cfg_dout[31:0]}), // Templated
|
||||||
.packet_in (etx_packet[PW-1:0]), // Templated
|
.mi_dout2 ({32'b0,mi_mmu_dout[31:0]}), // Templated
|
||||||
.mi_dout0 ({32'b0,mi_cfg_dout[31:0]}), // Templated
|
.wait_in (etx_cfg_wait)); // Templated
|
||||||
.mi_dout2 ({32'b0,mi_mmu_dout[31:0]}), // Templated
|
|
||||||
.wait_in (etx_cfg_wait)); // Templated
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
/* ETX CONFIGURATION REGISTERS */
|
//##################################################################
|
||||||
/************************************************************/
|
//# TX CONFIGURATION
|
||||||
|
//##################################################################
|
||||||
/*etx_cfg AUTO_TEMPLATE (.mi_dout (mi_cfg_dout[DW-1:0]),
|
/*etx_cfg AUTO_TEMPLATE (.mi_dout (mi_cfg_dout[DW-1:0]),
|
||||||
.mi_en (mi_cfg_en),
|
.mi_en (mi_cfg_en),
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//synchronizing signals from sys_clk fifo
|
|
||||||
|
|
||||||
assign tx_status[15:0] = {5'b0,
|
|
||||||
tx_burst,
|
|
||||||
tx_rd_wait,
|
|
||||||
tx_wr_wait,
|
|
||||||
etx_rd_wait,
|
|
||||||
etx_wr_wait,
|
|
||||||
txrr_wait,
|
|
||||||
txrd_wait,
|
|
||||||
txwr_wait,
|
|
||||||
txrr_full,
|
|
||||||
txrd_full,
|
|
||||||
txwr_full
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//configer register file
|
etx_cfg etx_cfg (.tx_status ({5'b0,
|
||||||
defparam etx_cfg.ID = ID;
|
tx_burst,
|
||||||
etx_cfg etx_cfg (
|
tx_rd_wait,
|
||||||
|
tx_wr_wait,
|
||||||
|
etx_rd_wait,
|
||||||
|
etx_wr_wait,
|
||||||
|
txrr_wait,
|
||||||
|
txrd_wait,
|
||||||
|
txwr_wait,
|
||||||
|
txrr_full,
|
||||||
|
txrd_full,
|
||||||
|
txwr_full
|
||||||
|
}),
|
||||||
/*AUTOINST*/
|
/*AUTOINST*/
|
||||||
// Outputs
|
// Outputs
|
||||||
.mi_dout (mi_cfg_dout[DW-1:0]), // Templated
|
.mi_dout (mi_cfg_dout[DW-1:0]), // Templated
|
||||||
@ -303,7 +294,6 @@ module etx_core(/*AUTOARG*/
|
|||||||
.mi_we (mi_we),
|
.mi_we (mi_we),
|
||||||
.mi_addr (mi_addr[RFAW+1:0]),
|
.mi_addr (mi_addr[RFAW+1:0]),
|
||||||
.mi_din (mi_din[31:0]),
|
.mi_din (mi_din[31:0]),
|
||||||
.tx_status (tx_status[15:0]),
|
|
||||||
.etx_access (etx_access),
|
.etx_access (etx_access),
|
||||||
.etx_packet (etx_packet[PW-1:0]));
|
.etx_packet (etx_packet[PW-1:0]));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user