rcp.vh 8.11 KB

`include "cbus.vh"
`include "addr.vh"

parameter LOW = 1'b0;
parameter HIGH = 1'b1;

// bus widths
// parameter CBUS_SELECT_SIZE	= 2;
// parameter CBUS_COMMAND_SIZE	= 3;
// parameter CBUS_DATA_SIZE	= 32;
parameter DBUS_DATA_SIZE	= 64;
parameter EBUS_DATA_SIZE	= 8;
parameter XBUS_DATA_SIZE	= 64;
parameter CP0_DATA_SIZE		= 32;
parameter IOBUF_ADDRESS_SIZE	= 4;
parameter IOBUF_DATA_SIZE 	= 64;

parameter DRAM_ADDRESS_SIZE	= 24;
parameter PBUS_ADDRESS_SIZE	= 32;

parameter DMA_OFFSET_SIZE	= 3;
parameter DMA_MASK_SIZE		= 8;
parameter DMA_ADDRESS_SIZE	= 32;
parameter DMA_LENGTH_SIZE	= 7;
parameter DMA_READ_SIZE		= 1;
parameter DMA_DELAY_SIZE	= 8;
parameter DMA_DEVICE_SIZE	= 4;

parameter IO_OFFSET_SIZE	= 2;
parameter BUS_ID_OFFSET		= 20;
parameter BUS_ID_SIZE		= 12;

parameter RSP_VERSION		= 8'd2;
parameter RDP_VERSION		= 8'd2;
parameter RI_VERSION		= 8'd8;
parameter IO_VERSION		= 8'd8;
parameter RCP_VERSION		= {RSP_VERSION,
				   RDP_VERSION,
				   RI_VERSION,
				   IO_VERSION};
// cbus select
// parameter
   // CBUS_ADDRESS_SELECT		= 2'd0,
   // CBUS_LENGTH_SELECT		= 2'd1,
   // CBUS_DATA_SELECT		= 2'd2;

// cbus command
// parameter
   // CBUS_DMA_COMMAND		= 3'd1,
   // CBUS_WRITE_COMMAND		= 3'd2,
   // CBUS_READ_COMMAND		= 3'd3,
   // CBUS_RESPONSE_COMMAND	= 3'd4,
   // CBUS_REFRESH_COMMAND		= 3'd5;		//XXX remove

// DMA transaction types
parameter
   DMA_BLOCK			= 1'b0,
   DMA_SUBBLOCK			= 1'b1,
   DMA_NON_MASKED		= 1'b0,
   DMA_MASKED			= 1'b1,
   DMA_UP			= 1'b0,
   DMA_DOWN			= 1'b1,
   DMA_SEQ			= 1'b0,
   DMA_NSEQ			= 1'b1,
   DMA_WRITE			= 1'b0,
   DMA_READ			= 1'b1;

// DBUS - CBUS address definitions
parameter
   DBUS_ADDRESS_START 		= 32'h0000_0000,
   DBUS_ADDRESS_END		= 32'h03ff_ffff,	//XXX dram space
   CBUS_ADDRESS_START 		= 32'h0400_0000,	//XXX
   CBUS_ADDRESS_END 		= 32'hffff_ffff;	//XXX

// configuration registers address space
//XXX add io modules;
parameter
   // BUS_ID_DRAM		= 'h000,
   // BUS_ID_RDRAM_CONFIG	= 'h03f,	//XXX remove
   BUS_ID_CBUS_START	= 'h040,
   // BUS_ID_SP		= 'h040,
   // BUS_ID_CMD		= 'h041,
   // BUS_ID_SPAN		= 'h042,
   // BUS_ID_MI		= 'h043,
   // BUS_ID_VI		= 'h044,
   // BUS_ID_AI		= 'h045,
   // BUS_ID_PI		= 'h046,
   // BUS_ID_RI		= 'h047,
   // BUS_ID_SI		= 'h048,
   // BUS_ID_PBUS		= 'h050,
   // BUS_ID_SIRAM		= 'h1fc,
   BUS_ID_EXT_START	= 'h800;	//XXX become all of dram

parameter
   BUS_ADDRESS_DRAM		= 32'h0000_0000,
   BUS_ADDRESS_RDRAM_CONFIG	= 32'h03f0_0000,	//XXX remove
   BUS_ADDRESS_SP		= 32'h0400_0000,
   BUS_ADDRESS_CMD		= 32'h0410_0000,
   BUS_ADDRESS_SPAN		= 32'h0420_0000,
   BUS_ADDRESS_MI		= 32'h0430_0000,
   BUS_ADDRESS_VI		= 32'h0440_0000,
   BUS_ADDRESS_AI		= 32'h0450_0000,
   BUS_ADDRESS_PI		= 32'h0460_0000,
   BUS_ADDRESS_RI		= 32'h0470_0000,
   BUS_ADDRESS_SI		= 32'h0480_0000,
   BUS_ADDRESS_PBUS		= 32'h0500_0000,
   BUS_ADDRESS_PIF		= 32'h1fc0_0000,	//XXX remove
   BUS_ADDRESS_EXT		= 32'h8000_0000;	//XXX become all of dram

parameter
   BUS_ADDRESS_SP_DMEM		= BUS_ADDRESS_SP + 20'h0_0000,
   BUS_ADDRESS_SP_IMEM		= BUS_ADDRESS_SP + 20'h0_1000,
   BUS_ADDRESS_SP_MASTER	= BUS_ADDRESS_SP + 20'h4_0000,
   BUS_ADDRESS_SP_SLAVE		= BUS_ADDRESS_SP + 20'h4_0004,
   BUS_ADDRESS_SP_READ		= BUS_ADDRESS_SP + 20'h4_0008,
   BUS_ADDRESS_SP_WRITE		= BUS_ADDRESS_SP + 20'h4_000c,
   BUS_ADDRESS_SP_STATUS	= BUS_ADDRESS_SP + 20'h4_0010,
   BUS_ADDRESS_SP_FULL		= BUS_ADDRESS_SP + 20'h4_0014,
   BUS_ADDRESS_SP_BUSY		= BUS_ADDRESS_SP + 20'h4_0018,
   BUS_ADDRESS_SP_SEMAPHORE	= BUS_ADDRESS_SP + 20'h4_001c,
   BUS_ADDRESS_SP_PC		= BUS_ADDRESS_SP + 20'h8_0000,
   BUS_ADDRESS_SP_BIST		= BUS_ADDRESS_SP + 20'h8_0004;

parameter
   BUS_ADDRESS_CMD_START	= BUS_ADDRESS_CMD + 20'h0_0000,
   BUS_ADDRESS_CMD_END		= BUS_ADDRESS_CMD + 20'h0_0004,
   BUS_ADDRESS_CMD_CURRENT	= BUS_ADDRESS_CMD + 20'h0_0008,
   BUS_ADDRESS_CMD_STATUS	= BUS_ADDRESS_CMD + 20'h0_000c,
   BUS_ADDRESS_CMD_CLOCK	= BUS_ADDRESS_CMD + 20'h0_0010,
   BUS_ADDRESS_CMD_FIFO_BUSY	= BUS_ADDRESS_CMD + 20'h0_0014,
   BUS_ADDRESS_CMD_PIPE_BUSY	= BUS_ADDRESS_CMD + 20'h0_0018,
   BUS_ADDRESS_CMD_TMEM_BUSY	= BUS_ADDRESS_CMD + 20'h0_001c;

parameter
   BUS_ADDRESS_SPAN_BIST	= BUS_ADDRESS_SPAN + 20'h0_0000,
   BUS_ADDRESS_SPAN_MODE	= BUS_ADDRESS_SPAN + 20'h0_0004,
   BUS_ADDRESS_SPAN_ADDR	= BUS_ADDRESS_SPAN + 20'h0_0008,
   BUS_ADDRESS_SPAN_DATA	= BUS_ADDRESS_SPAN + 20'h0_000c;

parameter
   BUS_ADDRESS_MI_INIT_MODE	= BUS_ADDRESS_MI + 20'h0_0000,
   BUS_ADDRESS_MI_VERSION	= BUS_ADDRESS_MI + 20'h0_0004,
   BUS_ADDRESS_MI_INTERRUPT	= BUS_ADDRESS_MI + 20'h0_0008,
   BUS_ADDRESS_MI_MASK		= BUS_ADDRESS_MI + 20'h0_000c;

parameter
   BUS_ADDRESS_PI_DRAM_ADDRESS	= BUS_ADDRESS_PI + 20'h0_0000,
   BUS_ADDRESS_PI_PBUS_ADDRESS	= BUS_ADDRESS_PI + 20'h0_0004,
   BUS_ADDRESS_PI_READ_LENGTH	= BUS_ADDRESS_PI + 20'h0_0008,
   BUS_ADDRESS_PI_WRITE_LENGTH	= BUS_ADDRESS_PI + 20'h0_000c,
   BUS_ADDRESS_PI_STATUS	= BUS_ADDRESS_PI + 20'h0_0010,
   BUS_ADDRESS_PI_DOM1_LAT	= BUS_ADDRESS_PI + 20'h0_0014,
   BUS_ADDRESS_PI_DOM1_PWD	= BUS_ADDRESS_PI + 20'h0_0018,
   BUS_ADDRESS_PI_DOM1_PGS	= BUS_ADDRESS_PI + 20'h0_001c,
   BUS_ADDRESS_PI_DOM1_RLS	= BUS_ADDRESS_PI + 20'h0_0020,
   BUS_ADDRESS_PI_DOM2_LAT	= BUS_ADDRESS_PI + 20'h0_0024,
   BUS_ADDRESS_PI_DOM2_PWD	= BUS_ADDRESS_PI + 20'h0_0028,
   BUS_ADDRESS_PI_DOM2_PGS	= BUS_ADDRESS_PI + 20'h0_002c,
   BUS_ADDRESS_PI_DOM2_RLS	= BUS_ADDRESS_PI + 20'h0_0030,
   BUS_ADDRESS_PI_IO_READ_REG	= BUS_ADDRESS_PI + 20'h0_0034,
   BUS_ADDRESS_PI_IO_WRITE_REG	= BUS_ADDRESS_PI + 20'h0_0038;

parameter
   BUS_ADDRESS_RI_MODE		= BUS_ADDRESS_RI + 20'h0_0000,
   BUS_ADDRESS_RI_CONFIG	= BUS_ADDRESS_RI + 20'h0_0004,
   BUS_ADDRESS_RI_CURRENT_LOAD	= BUS_ADDRESS_RI + 20'h0_0008,
   BUS_ADDRESS_RI_SELECT	= BUS_ADDRESS_RI + 20'h0_000c,
   BUS_ADDRESS_RI_REFRESH	= BUS_ADDRESS_RI + 20'h0_0010,
   BUS_ADDRESS_RI_LATENCY	= BUS_ADDRESS_RI + 20'h0_0014,
   BUS_ADDRESS_RI_ERROR		= BUS_ADDRESS_RI + 20'h0_0018,
   BUS_ADDRESS_RI_VALID		= BUS_ADDRESS_RI + 20'h0_001c;

// parameter
   // BUS_ADDRESS_SI_DRAM_ADDRESS	= BUS_ADDRESS_SI + 20'h0_0000,
   // BUS_ADDRESS_SI_PIF_AD_RD64B	= BUS_ADDRESS_SI + 20'h0_0004,
   // BUS_ADDRESS_SI_PIF_AD_WR4B	= BUS_ADDRESS_SI + 20'h0_0008,
   // BUS_ADDRESS_SI_PIF_AD_WR64B	= BUS_ADDRESS_SI + 20'h0_0010,
   // BUS_ADDRESS_SI_PIF_AD_RD4BCPU= BUS_ADDRESS_SI + 20'h0_0014,
   // BUS_ADDRESS_SI_STATUS	= BUS_ADDRESS_SI + 20'h0_0018;
// 
// parameter
   // BUS_ADDRESS_SI_PIF_ADDRESS	= BUS_ADDRESS_SI + 20'h0_0004,
   // BUS_ADDRESS_SI_READ_LENGTH	= BUS_ADDRESS_SI + 20'h0_0008,
   // BUS_ADDRESS_SI_WRITE_LENGTH	= BUS_ADDRESS_SI + 20'h0_000c;

parameter
   BUS_ADDRESS_AI_DRAM_ADDRESS	= BUS_ADDRESS_AI + 20'h0_0000,
   BUS_ADDRESS_AI_LENGTH	= BUS_ADDRESS_AI + 20'h0_0004,
   BUS_ADDRESS_AI_CONTROL	= BUS_ADDRESS_AI + 20'h0_0008,
   BUS_ADDRESS_AI_STATUS	= BUS_ADDRESS_AI + 20'h0_000c,
   BUS_ADDRESS_AI_DACRATE	= BUS_ADDRESS_AI + 20'h0_0010,
   BUS_ADDRESS_AI_BITRATE	= BUS_ADDRESS_AI + 20'h0_0014;


parameter
   BUS_ADDRESS_VI_CTRL		= BUS_ADDRESS_VI + 20'h0_0000,
   BUS_ADDRESS_VI_ORIGIN	= BUS_ADDRESS_VI + 20'h0_0004,
   BUS_ADDRESS_VI_WIDTH		= BUS_ADDRESS_VI + 20'h0_0008,
   BUS_ADDRESS_VI_V_INT		= BUS_ADDRESS_VI + 20'h0_000c,
   BUS_ADDRESS_VI_V_CURRENT	= BUS_ADDRESS_VI + 20'h0_0010,
   BUS_ADDRESS_VI_BURST		= BUS_ADDRESS_VI + 20'h0_0014,
   BUS_ADDRESS_VI_V_SYNC	= BUS_ADDRESS_VI + 20'h0_0018,
   BUS_ADDRESS_VI_H_SYNC	= BUS_ADDRESS_VI + 20'h0_001c,
   BUS_ADDRESS_VI_LEAP		= BUS_ADDRESS_VI + 20'h0_0020,
   BUS_ADDRESS_VI_H_START	= BUS_ADDRESS_VI + 20'h0_0024,
   BUS_ADDRESS_VI_V_START	= BUS_ADDRESS_VI + 20'h0_0028,
   BUS_ADDRESS_VI_V_BURST	= BUS_ADDRESS_VI + 20'h0_002c,
   BUS_ADDRESS_VI_X_SCALE	= BUS_ADDRESS_VI + 20'h0_0030,
   BUS_ADDRESS_VI_Y_SCALE	= BUS_ADDRESS_VI + 20'h0_0034,
   BUS_ADDRESS_VI_TEST_ADDR	= BUS_ADDRESS_VI + 20'h0_0038,
   BUS_ADDRESS_VI_TEST_DATA	= BUS_ADDRESS_VI + 20'h0_003c;

parameter
   BUS_ADDRESS_MASK		= 32'hfff0_0000;

// DMA master and slave id codes
// parameter
   // BUS_DEVICE_SP		= 4'd0,
   // BUS_DEVICE_DP_CMD		= 4'd1,
   // BUS_DEVICE_DP_SPAN		= 4'd2,
   // BUS_DEVICE_MI		= 4'd3,
   // BUS_DEVICE_VI		= 4'd4,
   // BUS_DEVICE_SI		= 4'd5,
   // BUS_DEVICE_PI		= 4'd6,
   // BUS_DEVICE_RI		= 4'd7,
   // BUS_DEVICE_AI		= 4'd8,
   // BUS_DEVICE_MEM		= 4'd9;

// maximum DMA packet size
// parameter MAX_DMA_LENGTH	= 7'd15;