| 1 |
6 |
btltz |
//File name=Module=Cfg_Ctrl 2005-04-03 btltz@mail.china.com btltz from CASIC
|
| 2 |
|
|
//Description: Transact commands.
|
| 3 |
|
|
// Include "control logic", "control/status register(and the gpio output pins)",
|
| 4 |
|
|
// "configuration port". Note routing tables is in "LSer".
|
| 5 |
|
|
//Origin: SpaceWire Std - Draft-1(Clause 9/10) of ECSS(European Cooperation for Space Standardization),ESTEC,ESA.
|
| 6 |
|
|
// SpaceWire Router Requirements Specification Issue 1 Rev 5. Astrium & University of Dundee
|
| 7 |
|
|
//-- TODO: make the rtl faster
|
| 8 |
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| 9 |
|
|
//
|
| 10 |
2 |
btltz |
|
| 11 |
6 |
btltz |
/*synthesize translate_off*/
|
| 12 |
|
|
`include "timescale.v"
|
| 13 |
|
|
/*synthesize translate_on */
|
| 14 |
|
|
`define reset 1 // WISHBONE standard reset
|
| 15 |
|
|
`define XIL_BRAM // Use Xilinx block RAM
|
| 16 |
|
|
`define XIL_DISRAM // Use Xilinx distributed RAM
|
| 17 |
|
|
`define TOOL_NOTSUP_PORT_ARRAY // If the tools not support port array declaration
|
| 18 |
|
|
|
| 19 |
|
|
|
| 20 |
|
|
module Cfg_Ctrl #(parameter DW=32,AW=32, IO_PORTNUM=16, CFG_AW=4, IO_DW=10, EXT_DW=9)
|
| 21 |
|
|
(
|
| 22 |
|
|
// interface with SpW I/O ports, External port
|
| 23 |
|
|
output [PORTNUM-1:0] rd_IBUF_o, // Note write to SpW IO port FIFO is performed by "switch core"
|
| 24 |
|
|
`ifdef TOOL_NOTSUP_PORT_ARRAY
|
| 25 |
|
|
input [IO_DW-1:0] SpW_D0_i, SpW_D1_i, SpW_D2_i, SpW_D3_i,
|
| 26 |
|
|
SpW_D4_i, SpW_D5_i, SpW_D6_i, SpW_D7_i,
|
| 27 |
|
|
SpW_D8_i, SpW_D9_i, SpW_D10_i,SpW_D11_i,
|
| 28 |
|
|
SpW_D12_i,SpW_D13_i,SpW_D14_i,SpW_D15_i,
|
| 29 |
|
|
|
| 30 |
|
|
`else
|
| 31 |
|
|
input [IO_DW-1:0] SpW_D_i [0:PORTNUM-1],
|
| 32 |
|
|
`endif
|
| 33 |
|
|
input [PORTNUM-1:0] empty_IBUF_i, // empty flag of SpW input interface buffer(fifo)
|
| 34 |
|
|
input [PORTNUM-1:0] full_OBUF_i, // full flag of SpW output interface buffer(fifo)
|
| 35 |
|
|
|
| 36 |
|
|
output [EXT_DW-1:0] EXT_data_o,
|
| 37 |
|
|
output we_EXTport_o,
|
| 38 |
|
|
output rd_EXTport_o,
|
| 39 |
|
|
input [EXT_DW-1:0] EXT_data_i,
|
| 40 |
|
|
input empty_eibuf_i, // empty flag of external input port buffer(fifo)
|
| 41 |
|
|
input full_eobuf_i, // full flag of external output port buffer(fifo)
|
| 42 |
|
|
|
| 43 |
|
|
// interface for user to inspect
|
| 44 |
|
|
output cfg_int_o, // interrupt the user application
|
| 45 |
|
|
output cfg_wrbusy_o, // configuration write in progress
|
| 46 |
2 |
btltz |
output[AW-1:0] cfg_int_addr,
|
| 47 |
|
|
input [AW-1:0] cfg_addr_i,
|
| 48 |
6 |
btltz |
//input [DW-1:0] cfg_data_i, // reserved
|
| 49 |
|
|
//input [] cfg_ben_i, // configuration byte enable
|
| 50 |
|
|
//input cfg_wren_i, // reserved
|
| 51 |
|
|
|
| 52 |
|
|
|
| 53 |
|
|
// global signal input
|
| 54 |
|
|
input reset,
|
| 55 |
|
|
input gclk
|
| 56 |
2 |
btltz |
);
|
| 57 |
|
|
|
| 58 |
6 |
btltz |
parameter EOP = 9'b1_0000_0000; // {p,1'b1,8'b0000_0000}
|
| 59 |
|
|
parameter EEP = 9'b1_0000_0001; // {p,1'b1,8'b0000_0001}
|
| 60 |
|
|
parameter HEADS_Cargo = 9'b0_xxxx_xxxx; // {p,1'b0,1-byte data }
|
| 61 |
|
|
// commands
|
| 62 |
|
|
parameter CMD_WRITE =;
|
| 63 |
|
|
parameter CMD_REQ_ID =;
|
| 64 |
2 |
btltz |
|
| 65 |
6 |
btltz |
parameter STATENUM = 8;
|
| 66 |
|
|
parameter RESET = 'b0000_0001;
|
| 67 |
|
|
parameter IDLE = 'b0000_0010;
|
| 68 |
|
|
parameter RCV_CMD = 'b0000_0100;
|
| 69 |
|
|
parameter
|
| 70 |
2 |
btltz |
|
| 71 |
6 |
btltz |
////////////////////////////
|
| 72 |
17 |
btltz |
// Registers(Control, status)
|
| 73 |
6 |
btltz |
//
|
| 74 |
2 |
btltz |
|
| 75 |
17 |
btltz |
`include "RegSWR.v"
|
| 76 |
|
|
|
| 77 |
6 |
btltz |
////////////////////////////
|
| 78 |
|
|
// Command & Reply
|
| 79 |
|
|
//
|
| 80 |
|
|
reg [7:0] cmd [0:13];
|
| 81 |
|
|
reg [7:0] rpy [0:11];
|
| 82 |
2 |
btltz |
|
| 83 |
6 |
btltz |
always @(posedge gclk)
|
| 84 |
2 |
btltz |
|
| 85 |
|
|
|
| 86 |
6 |
btltz |
endmodule
|
| 87 |
2 |
btltz |
|
| 88 |
6 |
btltz |
`undef reset
|
| 89 |
|
|
`undef TOOL_NOTSUP_PORT_ARRAY
|