⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcic_c.tdf

📁 Altera AHDL语言设计的PCI总线Core,很难得的PCI设计资料
💻 TDF
📖 第 1 页 / 共 5 页
字号:
	max_lat_dat[7..0]				: NODE;	-- Maximum Latency Register Data
	min_gnt_dat[7..0]				: NODE;	-- Minimum Grant Register Data
	
	bar_nibble[5..0][3..0]			: NODE;	-- Bar Lease Significant Nibble
	mem_access_enable				: NODE;
	io_access_enable				: NODE;
	mem_cyc							: LCELL;	-- Memory Cycle Indicator
	io_cyc							: LCELL;	-- I/O Cycle Indicator

	dac_config_sr					: SRFF;
	
BEGIN

--	bar_ro_bits[5..0][31..0]	= GND;
--dac mem_cyc	= 	(	cben_IR[3..1] == B"011"	)
--dac		or	(	cben_IR[3..0] == B"1100")
--dac		or	(	cben_IR[3..1] == B"111"	);

--mem_cyc	= 	(	cben_IR[3..1] == B"011"	)
--		or	(	cben_IR[3..0] == B"1100")
--		or	(	cben_IR[3..2] == B"11"	);

mem_cyc	= 	(	cben_IR_addr[3..1] == B"011"	)
					or	(	cben_IR_addr[3..0] == B"1100")
					or	(	cben_IR_addr[3..1] == B"111"	)
				;



		
io_cyc	=	(cben_IR_addr[3..1] == B"001");


	bar_nibble[0][3..0]	= BAR0_LS_NIBBLE;
	bar_nibble[1][3..0]	= BAR1_LS_NIBBLE;
	bar_nibble[2][3..0]	= BAR2_LS_NIBBLE;
	bar_nibble[3][3..0]	= BAR3_LS_NIBBLE;
	bar_nibble[4][3..0]	= BAR4_LS_NIBBLE;
	bar_nibble[5][3..0]	= BAR5_LS_NIBBLE;

	
	mem_access_enable		= cmd_reg1;
	io_access_enable		= cmd_reg0;
	

IF (BAR0_MEM_LOC == 2) GENERATE

	mem_bar_hit			= 	( bar_hit[0] and not dac_config_sr) --and dac_cfg )
						or 	( bar_hit[1] and dac_config_sr) --and dac_cfg)
						or 	( bar_hit[2]) --and not dac_cfg)
						or 	( bar_hit[3]) --and not dac_cfg)
						or  ( bar_hit[4]) --and not dac_cfg)
						or  ( bar_hit[5]) --and not dac_cfg)
						or	exp_rom_access;

ELSE GENERATE	
	
	mem_bar_hit			= 	( bar_hit[0] )
						or 	( bar_hit[1] )
						or 	( bar_hit[2] )
						or 	( bar_hit[3] )
						or  ( bar_hit[4] )
						or  ( bar_hit[5] )
						or	exp_rom_access;
END GENERATE;
									
	io_bar_hit			= mem_bar_hit;
-- Check and Generate BAR0 Specific Logic

	
cfg_adr_dec_tmp_node[0] = cfg_adr_dec.dec4R;
cfg_adr_dec_tmp_node[1] = cfg_adr_dec.dec5R;
cfg_adr_dec_tmp_node[2] = cfg_adr_dec.dec6R;
cfg_adr_dec_tmp_node[3] = cfg_adr_dec.dec7R;
cfg_adr_dec_tmp_node[4] = cfg_adr_dec.dec8R;
cfg_adr_dec_tmp_node[5] = cfg_adr_dec.dec9R;

ASSERT (NUMBER_OF_BARS >=1) 
	REPORT "NUMBER_OF_BARS = %, You must Instantiate at least one Base Address Register" NUMBER_OF_BARS
	SEVERITY ERROR;
	junk[]	= junk[] or ad_IR[] or adr_dec_ena OR lcfg_dat_in[] or ad_ir_addr[];
	junk[7..0]	= lcfg_adr[7..0];
	junk[3..0]	= lcfg_ben[3..0] OR cben_IR[3..0] or cben_ir_addr[3..0]
				or bar_nibble0_[]
				or bar_nibble1_[]
				or bar_nibble2_[]
				or bar_nibble3_[]
				or bar_nibble4_[]
				or bar_nibble5_[] ;
	junk0 		= junk0 or lcfg_dat_vld or lcfg_adr_vld or cfg_dat_vld
				OR cfg_adr_dec_tmp_node[0]
				OR cfg_adr_dec_tmp_node[1]
				OR cfg_adr_dec_tmp_node[2]
				OR cfg_adr_dec_tmp_node[3]
				OR cfg_adr_dec_tmp_node[4]
				OR cfg_adr_dec_tmp_node[5]
				OR exp_rom_hit_lc1
				OR exp_rom_hit_lc2
				OR dac_config_sr
				OR bar_hit_lc3
				OR io_access_enable
				or io_cyc;



	IF (HOST_BRIDGE_ENA == "NO") GENERATE
			junk[]	= junk[];
	ELSE GENERATE
	
		Assert Report "Local Host Interface is Enabled"
		Severity INFO;
		
	END GENERATE;



IF (NUMBER_OF_BARS >= 1+0) GENERATE

--	ASSERT (BAR0_MEM_LOC < 2)
--	REPORT " NUMBERS_OF_BARS Must Be Greater Than 1"
--	SEVERITY ERROR;


	IF (BAR0_READ_ONLY_BITS_32 < 32) GENERATE	-- if BAR0 Read Only Bits != 32 
		junk[]				= junk[] or bar0_ena3 or bar0_ena2 or bar0_ena1 or bar0_ena0;	
		IF (LOCAL_CONFIG_ENA == "NO") GENERATE
			bar0_ena[3..0]		= bar_selR[0] and cfg_dat_vld and not(cben_IR[3..0]);	
		ELSE  GENERATE
			bar0_ena[3..0]		= bar_selR[0] and lcfg_dat_vld and not lcfg_ben[3..0];
		END GENERATE;
		IF (BAR0_READ_ONLY_BITS > 4) GENERATE
			bar0_ro_bits[BAR0_READ_ONLY_BITS-1..4] 	= GND;			-- BAR0 Read Only Bits < 32
		END GENERATE;
	ELSE GENERATE
		bar0_ro_bits[BAR0_READ_ONLY_BITS_32-1..4] 	= GND;			-- BAR0 Read Only Bits = 32
	END GENERATE;

	bar_selR[0]			= cfg_adr_dec_tmp_node[0];	-- address decode 10h

	
	-- Check and REPORT value supplied for BAR0
--	IF (0 == 1) GENERATE ASSERT REPORT "this is bar 1" severity info; END GENERATE;
	
	IF (BAR0_TYPE == 1) GENERATE
---- I/O BAR
		IF (BAR0_MEM_LOC == 0 and BAR0_PREFETCH == 0 ) GENERATE 
			ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = I/O"
				32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS)
			SEVERITY INFO;
		ELSE GENERATE 
			ASSERT REPORT " Illegal Value [%] for BAR0 Parameter" BAR0
			SEVERITY ERROR;
		END GENERATE;
---- MEMORY BAR	
	ELSE GENERATE

		IF (BAR0_MEM_LOC == 0 and BAR0_PREFETCH == 0 ) GENERATE
			IF (BAR0_OVFL_N == 0) GENERATE
				ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = 2 GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
				32-BAR0_READ_ONLY_BITS 
				SEVERITY INFO;
			ELSE GENERATE
				
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=   1073741824) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
					32-BAR0_READ_ONLY_BITS, (2^BAR0_READ_ONLY_BITS) DIV  1073741824
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR0_READ_ONLY_BITS) <   1073741824)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % MBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
					32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1048576 
					SEVERITY INFO;
				END GENERATE;
				IF((CEIL(2^BAR0_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR0_READ_ONLY_BITS) < 1048576)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1024
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) < 1024) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS)
					SEVERITY INFO;
				END GENERATE;
			
			END GENERATE;
			
			
		END GENERATE;
		
		IF (BAR0_MEM_LOC == 0 and BAR0_PREFETCH == 1 ) GENERATE
			IF (BAR0_OVFL_N == 0) GENERATE
				ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = 2 GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Prefetchable"
				32-BAR0_READ_ONLY_BITS 
				SEVERITY INFO;
			ELSE GENERATE
				
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=   1073741824) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Prefetchable"
					32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV  1073741824
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR0_READ_ONLY_BITS) <   1073741824)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % MBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Prefetchable"
					32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1048576 
					SEVERITY INFO;
				END GENERATE;
				IF((CEIL(2^BAR0_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR0_READ_ONLY_BITS) < 1048576)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1024
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) < 1024) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS)
					SEVERITY INFO;
				END GENERATE;
			
			END GENERATE;
		
		END GENERATE;


		IF(BAR0_MEM_LOC == 1 and BAR0_PREFETCH == 0 ) GENERATE
		
			IF (BAR0_OVFL_N == 0) GENERATE
				ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [2 GBytes] cannot be located below 1 Meg Space." 
				SEVERITY Error;
			ELSE GENERATE
				
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=   1073741824) GENERATE
					ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [% GBytes] cannot be located below 1 Meg Space."  CEIL(2^BAR0_READ_ONLY_BITS) DIV  1073741824
					SEVERITY Error;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR0_READ_ONLY_BITS) <   1073741824)) GENERATE
					ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [% MBytes] cannot be located below 1 Meg Space."  CEIL(2^BAR0_READ_ONLY_BITS) DIV 1048576 
					SEVERITY error;
				END GENERATE;
				IF((CEIL(2^BAR0_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR0_READ_ONLY_BITS) < 1048576)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Below 1 Meg Space, Non-Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1024
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) < 1024) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Below 1 Meg Space, Non-Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS)
					SEVERITY INFO;
				END GENERATE;
			
			END GENERATE;

		END GENERATE;
		IF (BAR0_MEM_LOC == 1 and BAR0_PREFETCH == 1 ) GENERATE

			IF (BAR0_OVFL_N == 0) GENERATE
				ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [2 GBytes] cannot be located below 1 Meg Space." 
				SEVERITY Error;
			ELSE GENERATE
				
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=   1073741824) GENERATE
					ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [% GBytes] cannot be located below 1 Meg Space."  CEIL(2^BAR0_READ_ONLY_BITS) DIV  1073741824
					SEVERITY Error;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR0_READ_ONLY_BITS) <   1073741824)) GENERATE
					ASSERT REPORT "Error:  The value for BAR0 parameter is incorrect; The allocated memory [% MBytes] cannot be located below 1 Meg Space."  CEIL(2^BAR0_READ_ONLY_BITS) DIV 1048576 
					SEVERITY error;
				END GENERATE;
				IF((CEIL(2^BAR0_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR0_READ_ONLY_BITS) < 1048576)) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Below 1 Meg Space, Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1024
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR0_READ_ONLY_BITS) < 1024) GENERATE
					ASSERT REPORT "BAR0 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Below 1 Meg Space, Prefetchable"
						32-BAR0_READ_ONLY_BITS, CEIL(2^BAR0_READ_ONLY_BITS)
					SEVERITY INFO;
				END GENERATE;
			
			END GENERATE;

		END GENERATE;

		IF (BAR0_MEM_LOC == 2 and BAR0_PREFETCH == 0 ) GENERATE
			IF (BAR0_READ_ONLY_BITS_32 < 32) GENERATE
				IF (BAR0_OVFL_N == 0) GENERATE
					ASSERT REPORT "BAR0 and BAR1 Settings: Number of Address Bits Decoded = %, Size = 2 GBytes, Type = Memory, Location = Anywhere in the 64 Bit address Space, Non-Prefetchable"
					64-BAR_64BIT_ROB_BAR0
					SEVERITY INFO;
				ELSE GENERATE				
					IF (CEIL(2^BAR0_READ_ONLY_BITS) >=   1073741824) GENERATE
						ASSERT REPORT "BAR0 and BAR1 Settings: Number of Address Bits Decoded = %, Size = % GBytes, Type = Memory, Location = Anywhere in the 64 Bit address Space, Non-Prefetchable"
						64-BAR_64BIT_ROB_BAR0, (2^BAR0_READ_ONLY_BITS) DIV  1073741824
						SEVERITY INFO;
					END GENERATE;
					IF (CEIL(2^BAR0_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR0_READ_ONLY_BITS) <   1073741824)) GENERATE
						ASSERT REPORT "BAR0 and BAR1 Settings: Number of Address Bits Decoded = %, Size = % MBytes, Type = Memory, Location = Anywhere in the 64 Bit address Space, Non-Prefetchable"
						64-BAR_64BIT_ROB_BAR0, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1048576 
						SEVERITY INFO;
					END GENERATE;
					IF((CEIL(2^BAR0_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR0_READ_ONLY_BITS) < 1048576)) GENERATE
						ASSERT REPORT "BAR0 and BAR1 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Anywhere in the 64 Bit address Space, Non-Prefetchable"
						64-BAR_64BIT_ROB_BAR0, CEIL(2^BAR0_READ_ONLY_BITS) DIV 1024
						SEVERITY INFO;
					END GENERATE;
					IF (CEIL(2^BAR0_READ_ONLY_BITS) < 1024) GENERATE
						ASSERT REPORT "BAR0 and BAR1 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Anywhere in the 64 Bit address Space, Non-Prefetchable"
						64-BAR_64BIT_ROB_BAR0, CEIL(2^BAR0_READ_ONLY_BITS)
						SEVERITY INFO;
					END GENERATE;
				END GENERATE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -