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

📄 pcic_c.tdf

📁 Altera AHDL语言设计的PCI总线
💻 TDF
📖 第 1 页 / 共 5 页
字号:
			END GENERATE;
		
			IF(BAR1_MEM_LOC == 1 and BAR1_PREFETCH == 0 ) GENERATE
		
				IF (BAR1_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^BAR1_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^BAR1_READ_ONLY_BITS) DIV  1073741824
						SEVERITY Error;
					END GENERATE;
					IF (CEIL(2^BAR1_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR1_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^BAR1_READ_ONLY_BITS) DIV 1048576 
						SEVERITY error;
					END GENERATE;
					IF((CEIL(2^BAR1_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR1_READ_ONLY_BITS) < 1048576)) GENERATE
						ASSERT REPORT "BAR1 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Below 1 Meg Space, Non-Prefetchable"
						32-BAR1_READ_ONLY_BITS, CEIL(2^BAR1_READ_ONLY_BITS) DIV 1024
						SEVERITY INFO;
					END GENERATE;
					IF (CEIL(2^BAR1_READ_ONLY_BITS) < 1024) GENERATE
						ASSERT REPORT "BAR1 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Below 1 Meg Space, Non-Prefetchable"
						32-BAR1_READ_ONLY_BITS, CEIL(2^BAR1_READ_ONLY_BITS)
						SEVERITY INFO;
					END GENERATE;
				END GENERATE;
			END GENERATE;
			IF (BAR1_MEM_LOC == 1 and BAR1_PREFETCH == 1 ) GENERATE

				IF (BAR1_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^BAR1_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^BAR1_READ_ONLY_BITS) DIV  1073741824
						SEVERITY Error;
					END GENERATE;
					IF (CEIL(2^BAR1_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR1_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^BAR1_READ_ONLY_BITS) DIV 1048576 
						SEVERITY error;
					END GENERATE;
					IF((CEIL(2^BAR1_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR1_READ_ONLY_BITS) < 1048576)) GENERATE
						ASSERT REPORT "BAR1 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Below 1 Meg Space, Prefetchable"
						32-BAR1_READ_ONLY_BITS, CEIL(2^BAR1_READ_ONLY_BITS) DIV 1024
						SEVERITY INFO;
					END GENERATE;
					IF (CEIL(2^BAR1_READ_ONLY_BITS) < 1024) GENERATE
						ASSERT REPORT "BAR1 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = Memory, Location = Below 1 Meg Space, Prefetchable"
						32-BAR1_READ_ONLY_BITS, CEIL(2^BAR1_READ_ONLY_BITS)
						SEVERITY INFO;
					END GENERATE;
				END GENERATE;
			END GENERATE;	

		END GENERATE;

	END GENERATE;

	IF (BAR0_MEM_LOC < 2) GENERATE
		IF (BAR1_MEM_LOC > 1) GENERATE
				ASSERT REPORT " Illegal Memory Type Value for BAR1 "
				SEVERITY ERROR;
		END GENERATE;
	END GENERATE;


	-- Set BAR1 R/W Registers Controls

	bar1_reg[].clk	= clk ;
	bar1_reg[].clrn	= rstN;
	
	IF (LOCAL_CONFIG_ENA == "NO") GENERATE
		IF (BAR0_MEM_LOC < 2) GENERATE
			bar1_reg[].d	= ad_IR[31..BAR1_READ_ONLY_BITS];
		ELSE GENERATE
			IF (BAR1_OVFL_N == 0) GENERATE
				bar1_reg[].d	= ad_IR[31..BAR1_READ_ONLY_BITS];
			ELSE GENERATE
--				bar1_reg[].d	= ad_IR[31..BAR1_READ_ONLY_BITS_0];
				bar1_reg[].d	= ad_IR[7..BAR1_READ_ONLY_BITS_0];
			END GENERATE;
		END GENERATE;
	ELSE  GENERATE
		IF (BAR0_MEM_LOC < 2) GENERATE
			bar1_reg[].d	= lcfg_dat_in[31..Bar1_Read_ONLY_BITS];
		ELSE GENERATE
			IF (BAR1_OVFL_N == 0) GENERATE
				bar1_reg[].d	= lcfg_dat_in[31..Bar1_Read_ONLY_BITS];
			ELSE GENERATE
				bar1_reg[].d	= lcfg_dat_in[Bar1_Read_write_BITS-1..0];
			END GENERATE;
		END GENERATE;
	END GENERATE;

IF (BAR0_MEM_LOC < 2) GENERATE	
	IF (BAR1_READ_ONLY_BITS < 8) GENERATE
		bar1_reg[31..24].ena						= bar1_ena[3];
		bar1_reg[23..16].ena						= bar1_ena[2];
		bar1_reg[15..8].ena							= bar1_ena[1];
		bar1_reg[7..BAR1_READ_ONLY_BITS].ena		= bar1_ena[0];
	ELSE GENERATE
		IF (BAR1_READ_ONLY_BITS < 16) GENERATE
			bar1_reg[31..24].ena						= bar1_ena[3];
			bar1_reg[23..16].ena						= bar1_ena[2];
			bar1_reg[15..BAR1_READ_ONLY_BITS].ena		= bar1_ena[1];
		ELSE GENERATE 
			IF (BAR1_READ_ONLY_BITS < 24) GENERATE
				bar1_reg[31..24].ena						= bar1_ena[3];
				bar1_reg[23..BAR1_READ_ONLY_BITS].ena		= bar1_ena[2];
			ELSE GENERATE
				bar1_reg[31..BAR1_READ_ONLY_BITS].ena	= bar1_ena[3];
			END GENERATE;
		END GENERATE;
	END GENERATE;

ELSE GENERATE

	IF (BAR1_OVFL_N == 0) GENERATE
		bar1_reg[31..BAR1_READ_ONLY_BITS].ena	= bar1_ena[3];
	ELSE GENERATE
		IF (BAR1_READ_ONLY_BITS_0 < 8) GENERATE
--			bar1_reg[31..24].ena						= bar1_ena[3];
--			bar1_reg[23..16].ena						= bar1_ena[2];
--			bar1_reg[15..8].ena							= bar1_ena[1];
			bar1_reg[BAR1_READ_WRITE_BITS-1..0].ena		= bar1_ena[0];
		ELSE GENERATE
			IF (BAR1_READ_ONLY_BITS_0 < 16) GENERATE
				bar1_reg[31..24].ena						= bar1_ena[3];
				bar1_reg[23..16].ena						= bar1_ena[2];
				bar1_reg[15..BAR1_READ_ONLY_BITS_0].ena		= bar1_ena[1];
			ELSE GENERATE 
				IF (BAR1_READ_ONLY_BITS_0 < 24) GENERATE
					bar1_reg[31..24].ena						= bar1_ena[3];
					bar1_reg[23..BAR1_READ_ONLY_BITS_0].ena		= bar1_ena[2];
				ELSE GENERATE
					bar1_reg[31..BAR1_READ_ONLY_BITS_0].ena	= bar1_ena[3];
				END GENERATE;
			END GENERATE;
		END GENERATE;
	END GENERATE;

END GENERATE;	

	-- Set the 32 bit value of BAR1
	-- This was added because I/O Base Address register can have only 16 bytes available
IF (BAR0_MEM_LOC < 2) GENERATE
	IF (BAR1_READ_ONLY_BITS > 4) GENERATE		
		bar[1][] = (bar1_reg[],bar1_ro_bits[BAR1_READ_ONLY_BITS-1..4],(bar_nibble[1][]));
	ELSE GENERATE
		bar[1][] = (bar1_reg[],(bar_nibble[1][]));
	END GENERATE;

ELSE GENERATE
	IF (BAR1_OVFL_N == 0) GENERATE
			bar[1][] = (bar1_reg[],bar1_ro_bits[BAR1_READ_ONLY_BITS-1..0]);		
	ELSE GENERATE
		IF (BAR1_READ_ONLY_BITS_0 > 0) GENERATE 
--			bar[1][] = (bar1_reg[],bar1_ro_bits[BAR1_READ_ONLY_BITS_0-1..0]);
			bar[1][] = (bar1_ro_bits_upper[31..8],bar1_reg[],bar1_ro_bits_lower[BAR1_READ_ONLY_BITS_0-1..0]);
		ELSE GENERATE -- BAR1_READ_ONLY_BITS = 0
			bar[1][] = (bar1_ro_bits_upper[31..8],bar1_reg[]);
		END GENERATE;
	END GENERATE;
END GENERATE;




	-- Connect The Ports of BAR1 Address Comparator
	dac_config_sr.clk = clk;
	dac_config_sr.clrn = rstn;

	
	IF (BAR0_MEM_LOC < 2) GENERATE
		bar1_comp.dataa[]	= bar1_reg[] ;
		bar1_comp.datab[]	= ad_IR_addr[31 .. BAR1_READ_ONLY_BITS];	-- Only Upper Most Address Bits are Decoded
--		bar_hit[1] 		= bar1_comp.aeb and lcell ( adr_phase and ( 	(	NOT bar_nibble[1][0] and mem_cyc and mem_access_enable and not dac_cfg)
--																		OR	(	bar_nibble[1][0]	 and io_cyc and io_access_enable)
--																	   )
--													   );
		bar_hit_lc1 = LCELL(NOT bar_nibble[1][0] and mem_cyc and mem_access_enable and not dac_cfg);
		bar_hit_lc2 = LCELL(bar_nibble[1][0] and io_cyc and io_access_enable);
		bar_hit_lc3 = LCELL( adr_phase and ( 	(	bar_hit_lc1)
																		OR	( bar_hit_lc2 )
																	   )
													   );
		bar_hit[1] 		= bar1_comp.aeb and bar_hit_lc3; 
		dac_config_sr.s = gnd;
		dac_config_sr.r = vcc;

	ELSE GENERATE

		IF (BAR1_OVFL_N == 0) GENERATE
			bar1_comp.dataa[]	= bar1_reg[] ;
			bar1_comp.datab[]	= ad_IR_addr[31 .. BAR1_READ_ONLY_BITS];	-- Only Upper Most Address Bits are Decoded
--			bar_hit[1] 		= bar1_comp.aeb and lcell ( adr_phase and ( 	(	NOT bar_nibble[0][0] and (mem_cyc % or dac_cfg%) and mem_access_enable and dac_cfg)
--																		--OR	( io_cyc and io_access_enable)-- no I/O cycle in 64-bit addressing
--																	   )
--													   );
			bar_hit_lc1 = LCELL(NOT bar_nibble[0][0] and mem_cyc and mem_access_enable and dac_cfg);
			bar_hit_lc2 = LCELL( adr_phase and bar_hit_lc1) ;
			bar_hit_lc3 = gnd;
			bar_hit[1] 	= bar1_comp.aeb and bar_hit_lc2;

			dac_config_sr.s = not(bar1_reg[] == BAR1_ALL_0);
			dac_config_sr.r = (bar1_reg[] == BAR1_ALL_0);

		ELSE GENERATE
			bar1_comp.dataa[]	= bar1_reg[] ;
--			bar1_comp.datab[]	= ad_IR_addr[31 .. BAR1_READ_ONLY_BITS_0];	-- Only Upper Most Address Bits are Decoded
			bar1_comp.datab[]	= ad_IR_addr[7..BAR1_READ_ONLY_BITS_0];	-- Only Upper Most Address Bits are Decoded
--			bar_hit[1] 		= bar1_comp.aeb and lcell ( adr_phase and ( 	(	NOT bar_nibble[0][0] and (mem_cyc %or dac_cfg%) and mem_access_enable and dac_cfg)
--																		--OR	( io_cyc and io_access_enable)-- no I/O cycle in 64-bit addressing
--																	   )
--													   );
			bar_hit_lc1 = LCELL(NOT bar_nibble[0][0] and mem_cyc and mem_access_enable and dac_cfg);
			bar_hit_lc2 = LCELL( adr_phase and bar_hit_lc1 );
			bar_hit_lc3 = gnd;
			bar_hit[1] 	= bar1_comp.aeb and bar_hit_lc2;


			dac_config_sr.s = not(bar1_reg[] == BAR1_ALL_0);
			dac_config_sr.r = (bar1_reg[] == BAR1_ALL_0);
		END GENERATE;

	END GENERATE;

	dac_out			= dac_config_sr;

	-- Set BAR1 Address Compare Hit Register Controls
	
	bar_hitR[1].clk	 = clk;
	bar_hitR[1].clrn = rstN;
							
	bar_hitR[1].r	= bar_hit_rst;
	bar_hitR[1].s	= bar_hit[1] ;
ELSE GENERATE
	bar_hit[5..1]	= GND;
	bar_selR[1]		= GND ;		-- Bar1 Register Select
	bar_hitR[5..1].clk = Clk;
	bar_hitR[5..1].clrn = rstN;
	bar_hitR[5..1].r = bar_hit_rst;
	bar_hitR[5..1].s	= GND;
	bar[5..1][]		= H"00000000";
END GENERATE;

IF (NUMBER_OF_BARS >= 1+2) GENERATE

	junk[]				= junk[] or bar2_ena3 or bar2_ena2 or bar2_ena1 or bar2_ena0;

	bar_selR[2]			= cfg_adr_dec_tmp_node[2];
	
	IF (LOCAL_CONFIG_ENA == "NO") GENERATE
	
		bar2_ena[3..0]		= bar_selR[2] and cfg_dat_vld and not(cben_IR[3..0]);
	
	ELSE  GENERATE
	
		bar2_ena[3..0]		= bar_selR[2] and lcfg_dat_vld and not lcfg_ben[3..0];
	
	END GENERATE;
	
	IF (BAR2_READ_ONLY_BITS > 4) GENERATE
	
		bar2_ro_bits[BAR2_READ_ONLY_BITS-1..4] 	= GND;			-- BAR2 Read Only Bits
		
	END GENERATE;
	

	-- Check and REPORT value supplied for BAR2
--	IF (2 == 1) GENERATE ASSERT REPORT "this is bar 1" severity info; END GENERATE;
	IF (BAR2_TYPE == 1) GENERATE
		IF (BAR2_MEM_LOC == 0 and BAR2_PREFETCH == 0 ) GENERATE
			ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = % Bytes, Type = I/O"
				32-BAR2_READ_ONLY_BITS, CEIL(2^BAR2_READ_ONLY_BITS)
			SEVERITY INFO;
		else GENERATE 
			ASSERT REPORT " Illegal Value [%] for BAR2 Parameter" BAR2
			SEVERITY ERROR;
		end GENERATE;
	
	else GENERATE
		IF (BAR2_MEM_LOC == 0 and BAR2_PREFETCH == 0 ) GENERATE
			IF (BAR2_OVFL_N == 0) GENERATE
				ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = 2 GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
				32-BAR2_READ_ONLY_BITS 
				SEVERITY INFO;
			ELSE GENERATE
				
				IF (CEIL(2^BAR2_READ_ONLY_BITS) >=   1073741824) GENERATE
					ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = % GBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
					32-BAR2_READ_ONLY_BITS, (2^BAR2_READ_ONLY_BITS) DIV  1073741824
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR2_READ_ONLY_BITS) >=  1048576 and (CEIL(2^BAR2_READ_ONLY_BITS) <   1073741824)) GENERATE
					ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = % MBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
					32-BAR2_READ_ONLY_BITS, CEIL(2^BAR2_READ_ONLY_BITS) DIV 1048576 
					SEVERITY INFO;
				END GENERATE;
				IF((CEIL(2^BAR2_READ_ONLY_BITS) >= 1024)  and (CEIL(2^BAR2_READ_ONLY_BITS) < 1048576)) GENERATE
					ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = % KBytes, Type = Memory, Location = Anywhere in the 32 Bit address Space, Non-Prefetchable"
						32-BAR2_READ_ONLY_BITS, CEIL(2^BAR2_READ_ONLY_BITS) DIV 1024
					SEVERITY INFO;
				END GENERATE;
				IF (CEIL(2^BAR2_READ_ONLY_BITS) < 1024) GENERATE
					ASSERT REPORT "BAR2 Settings: Number of Address Bits Decoded = %, Size = 

⌨️ 快捷键说明

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