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

📄 pcic_t.tdf

📁 Altera AHDL语言设计的PCI总线
💻 TDF
📖 第 1 页 / 共 5 页
字号:

	lr_sm.clk	= clk;
	lr_sm.reset	= not rstn;

	CASE lr_sm IS

		-- TS_IDLE State
		WHEN LR_IDLE	=> 	IF (TS_ADR_VLD and not wr_rdn and not cfg_cyc and not retry 
							and not serr_sig_set and lt_abortn and lt_discn ) THEN	-- Begining of I/O or Mem Read Cycle is detected
							lr_sm = LR_LXFR;							-- Go to the local Transfer State
							LR_LXFR_d = VCC;
						ELSE
							lr_sm = LR_IDLE;
							LR_IDLE_d = VCC;
						END IF;
						
		-- Local Xfr state.  Wait for local side to transfer First DWORD
		WHEN LR_LXFR	=> 	
						IF (not lt_abortn or not lt_discn OR TS_DISC) THEN		-- Local Side signaled ABORT or DISCONNECT
							lr_sm	= LR_DONE;						-- Local DONE
							LR_DONE_d = VCC;
						ELSIF (not lt_rdynR and direct_xfr) THEN						-- Local Side transferred the First Word
							lr_sm = LR_PXFR;
							LR_PXFR_d = VCC;
						ELSIF (not lt_rdynR and not direct_xfr) THEN
							lr_sm = LR_PXFR_32;
							LR_PXFR_32_d = VCC;
						ELSE
							lr_sm = LR_LXFR;						-- Wait for word to xferred from Local side
							LR_LXFR_d = VCC;
						END IF;

		-- Local PCI transfer for 64 bit local to 32 bti PCI
		-- Transfer the low bits
		WHEN LR_PXFR_32 =>		
						IF (not lt_abortn OR not frame) THEN
							lr_sm = LR_DONE;
							LR_DONE_d = VCC;
						ELSIF (irdy) THEN
							lr_sm = LR_PXFR;
							LR_PXFR_d = VCC;
						ELSE
							lr_sm = LR_PXFR_32;
							LR_PXFR_32_d = VCC;
						END IF;
					
		-- PCI XFR State, Pipe has One Words in it
		-- For 64->64 all bits are transferred, for 64->32 the high bits are transfered in this state
		WHEN LR_PXFR	=>
					 	IF (not lt_abortn or not frame or TS_DISC) THEN			-- Target Abort or Normal Termination by master
							lr_sm	= LR_DONE;
							LR_DONE_d = VCC;
						ELSIF (not irdy and not lt_rdynR and direct_xfr)  THEN			-- PCI side asserted wait states but local side transferred 
							lr_sm = LR_WAIT;						-- additional words
							LR_WAIT_d = VCC;
						ELSIF (irdy and lt_rdynR) THEN				-- PCI side accepted data and local side did not xfr data
							lr_sm = LR_LXFR;						-- more data to send to PCI
							LR_LXFR_d = VCC;
						ELSIF (not irdy and not lt_rdynR and not direct_xfr) THEN
							lr_sm = LR_WAIT_32;
							LR_WAIT_32_d = VCC;
						ELSIF (irdy and not lt_rdynR and not direct_xfr) THEN
							lr_sm = LR_PXFR_32;
							LR_PXFR_32_d = VCC;
						ELSE
							lr_sm = LR_PXFR;
							LR_PXFR_d = VCC;
						END IF;


		-- PCI Wait State, Pipe has Two 64 bit Words in it
		-- Wait for IRDY
		WHEN LR_WAIT	=>
					 	IF (not lt_abortn or not frame) THEN			-- Local Side signaled an abort or PCI is done
							lr_sm	= LR_DONE;
							LR_DONE_d = VCC;
						ELSIF(irdy ) THEN					-- Detected wait is ending and other data is in pipe
							lr_sm = LR_PXFR;
							LR_PXFR_d = VCC;
						ELSE
							lr_sm = LR_WAIT;
							LR_WAIT_d = VCC;
						END IF;

		-- PCI 32 bit Wait State, Pipe has Three 32 bit Words in it
		-- For 64->32 the low bits of the previous word is transferred in this state
		WHEN LR_WAIT_32 =>
						IF (not lt_abortn or not frame) THEN
							lr_sm = LR_DONE;
							LR_DONE_d = VCC;
						ELSIF (irdy) THEN
							lr_sm = LR_PXFR_32;
							LR_PXFR_32_d = VCC;
						ELSE 
							lr_sm = LR_WAIT_32;
							LR_WAIT_32_d = VCC;
						END IF;
						
		WHEN LR_DONE	=> 	lr_sm = LR_IDLE;
							LR_IDLE_d = VCC;

		
	END CASE;
%
LR_WAIT_32_d = (LR_PXFR and not (not lt_abortn or not frame or TS_DISC) 
					and not (not irdy and not lt_rdynR and direct_xfr) 
					and not (not irdy and not lt_rdynR and direct_xfr)
					and not (irdy and lt_rdynR)
					and (not irdy and not lt_rdynR and not direct_xfr))
				OR
			(LR_WAIT_32 and not (not lt_abortn or not frame) and not (irdy));
%
%
LR_IDLE = not LR_IDLE_not;

LR_IDLE_d = (LR_IDLE and not (TS_ADR_VLD and not wr_rdn and not cfg_cyc and not retry and not serr_sig_set and lt_abortn and lt_discn) )
			OR (LR_DONE);

LR_LXFR_d = (LR_IDLE and (TS_ADR_VLD and not wr_rdn and not cfg_cyc and not retry and not serr_sig_set and lt_abortn and lt_discn ))
			OR (LR_LXFR and not (not lt_abortn or not lt_discn OR TS_DISC) and not (not lt_rdynR and direct_xfr) and not (not lt_rdynR and not direct_xfr))
			OR (LR_PXFR and not (not lt_abortn or not frame or TS_DISC)  and not (not irdy and not lt_rdynR and direct_xfr) and (irdy and lt_rdynR));

LR_PXFR_32_d = (LR_LXFR and not (not lt_abortn or not lt_discn OR TS_DISC) and not (not lt_rdynR and direct_xfr) and (not lt_rdynR and not direct_xfr) )
			OR (LR_PXFR_32 and not (not lt_abortn OR not frame) and not (irdy))
			OR (LR_PXFR and not (not lt_abortn or not frame or TS_DISC) and not (not irdy and not lt_rdynR and direct_xfr) and not (irdy and lt_rdynR) and not (not irdy and not lt_rdynR and not direct_xfr) and (irdy and not lt_rdynR and not direct_xfr) )
			OR (LR_WAIT_32 and not (not lt_abortn or not frame) and (irdy));

LR_PXFR_d = (LR_LXFR and not (not lt_abortn or not lt_discn OR TS_DISC) and (not lt_rdynR and direct_xfr))
			OR (LR_PXFR_32 and not (not lt_abortn OR not frame) and (irdy))
			OR (LR_PXFR and not (not lt_abortn or not frame or TS_DISC) and not (not irdy and not lt_rdynR and direct_xfr) and not (irdy and lt_rdynR) and not (not irdy and not lt_rdynR and not direct_xfr) and not (irdy and not lt_rdynR and not direct_xfr) )
			OR (LR_WAIT and not (not lt_abortn or not frame) and (irdy) ) ;

LR_WAIT_d = (LR_PXFR and not (not lt_abortn or not frame or TS_DISC) and (not irdy and not lt_rdynR and direct_xfr))
			OR (LR_WAIT and not (not lt_abortn or not frame) and not (irdy));

LR_WAIT_32_d = (LR_PXFR and not (not lt_abortn or not frame or TS_DISC) and not (not irdy and not lt_rdynR and direct_xfr) and not (irdy and lt_rdynR) and (not irdy and not lt_rdynR and not direct_xfr))
				OR (LR_WAIT_32 and not (not lt_abortn or not frame) and not (irdy));

LR_DONE_d = (LR_LXFR and (not lt_abortn or not lt_discn OR TS_DISC))
			OR (LR_PXFR_32 and (not lt_abortn OR not frame)) 
			OR (LR_PXFR AND (not lt_abortn or not frame or TS_DISC) )
			OR (LR_WAIT and (not lt_abortn or not frame))
			OR (LR_WAIT_32 and (not lt_abortn or not frame));     
%




ELSE GENERATE

	Assert REPORT "-------- *** OPTIMIZING TARGET *** ----------"
	Severity Debug;

	
-- Target State Machine


	(TS_IDLE_not, 		
	TS_ADR_VLD, 	
	TS_ADR_CLMD, 	
	TS_DXFR, 					
	TS_LRD_WAIT, 	
	TS_DISC, 		
	TS_TURN_AR).clk		= clk;


	(TS_IDLE_not, 		
	TS_ADR_VLD, 	
	TS_ADR_CLMD, 	
	TS_DXFR, 					
	TS_LRD_WAIT, 	
	TS_DISC, 		
	TS_TURN_AR).clrn		= rstn;

	(TS_IDLE_not, 		
	TS_ADR_VLD, 	
	TS_ADR_CLMD, 	
	TS_DXFR, 					
	TS_LRD_WAIT, 	
	TS_DISC, 		
	TS_TURN_AR).d		=  (not 	TS_IDLE_d, 		
							TS_ADR_VLD_d, 	
							TS_ADR_CLMD_d, 	
							TS_DXFR_d, 											
							TS_LRD_WAIT_d, 	
							TS_DISC_d, 		
							TS_TURN_AR_d);

	TS_IDLE = not TS_IDLE_not;

	TS_IDLE_d_lc = LCELL((TS_ADR_VLD and  serr_sig_set)
				OR (TS_TURN_AR));
	TS_IDLE_d = (TS_IDLE and not targ_trig)
				OR TS_IDLE_d_lc;

	TS_ADR_VLD_d = (TS_IDLE and targ_trig);



	TS_ADR_CLMD_d = (TS_ADR_VLD and not serr_sig_set)
					OR (TS_DXFR_d_lc2
								 and not ((not lt_rdyn) or cfg_cyc));

------- TS_DXFR_d Optimization ----------------------------------------------------------------


--	TS_DXFR_d = (TS_ADR_CLMD and not ((retry or not lt_discn or not lt_abortn) and not cfg_cyc) 
--						and ((not lt_rdyn) or cfg_cyc))
--				OR (TS_DXFR and not (not lt_abortn or not lt_discn) 
--						  and not (not frame and trdy_OR))
--				OR (TS_LRD_WAIT and not (not lt_abortn OR not lt_discn) 
--							 and LR_PXFR);
	TS_DXFR_d_lc1 = LCELL((retry or not lt_discn or not lt_abortn) and not cfg_cyc);
	TS_DXFR_d_lc2 = LCELL(TS_ADR_CLMD and not (TS_DXFR_d_lc1 or mstr_actv) );
	TS_DXFR_d_lc3 = LCELL(TS_LRD_WAIT and not (not lt_abortn OR not lt_discn) 
							 and LR_PXFR);
	TS_DXFR_d_lc4 = LCELL(
					(TS_DXFR_d_lc2
							and ((not lt_rdyn) or cfg_cyc))
					OR TS_DXFR_d_lc3 );
	TS_DXFR_d_lc5 = LCELL(
								TS_DXFR and not (not lt_abortn or not lt_discn)
							);
	TS_DXFR_d = TS_DXFR_d_lc4
					OR  (TS_DXFR_d_lc5 and not (not frame and trdy_OR));

------ TS_LRD_WAIT_d Optimization -------------------------------------------------------------



	TS_LRD_WAIT_d = (TS_LRD_WAIT and not (not lt_abortn OR not lt_discn) 
						    and not LR_PXFR);

----- TS_DISC_d Optimization ------------------------------------------------------------------


--	TS_DISC_d = (TS_ADR_CLMD and ((retry or not lt_discn or not lt_abortn) and not cfg_cyc))
--				OR (TS_DXFR and (not lt_abortn or not lt_discn))	
--				OR (TS_LRD_WAIT and (not lt_abortn OR not lt_discn))
--				OR (TS_DISC and not (not frame));



	TS_DISC_d = LCELL(
					(TS_ADR_CLMD and (((retry or not lt_discn or not lt_abortn) and not cfg_cyc) or mstr_actv))
						OR (TS_DXFR and (not lt_abortn or not lt_discn))	
						OR (TS_LRD_WAIT and (not lt_abortn OR not lt_discn))
				  )
				OR (TS_DISC and not (not frame));

------ TS_TURN_AR_d Optimization ---------------------------------------------------------------


--	TS_TURN_AR_d = (TS_DXFR and not (not lt_abortn or not lt_discn) 
--					    and (not frame and trdy_OR))
--					OR (TS_DISC and (not frame));
	TS_TURN_AR_d = (LCELL(
						(TS_DXFR and not (not lt_abortn or not lt_discn))
						)	 
					    and (not frame and trdy_OR)
					)
					OR (TS_DISC and (not frame));


 
	


-- Target Write State Machine


	(LW_IDLE_not,	
	LW_LXFR,
	LW_WAIT,
	LW_DONE).clk		= clk;

	(LW_IDLE_not,	
	LW_LXFR,
	LW_WAIT,
	LW_DONE).clrn		= rstn;

	(LW_IDLE_not,	
	LW_LXFR,
	LW_WAIT,
	LW_DONE).d		= (not 	LW_IDLE_d,	
							LW_LXFR_d,
							LW_WAIT_d,
							LW_DONE_d);			

	LW_IDLE = not LW_IDLE_not;


	LW_IDLE_d = (LW_IDLE and not (TS_ADR_CLMD and not lt_rdyn and not cfg_cyc and wr_rdn and not serr_sig_set and lt_abortn and not retry))
				OR (LW_DONE);

-------- LW_LXFR_d Optimization ---------------------------------------------------------


--	LW_LXFR_d = (LW_IDLE and (TS_ADR_CLMD and not lt_rdyn and not cfg_cyc and wr_rdn and not serr_sig_set and lt_abortn and not retry))
--				OR (LW_LXFR and not (not lt_rdyn and not TS_DXFR and TS_DISC and irdy) and not (TS_TURN_AR) and not (lt_rdyn and irdy))
--				OR (LW_WAIT and not (data_timeout_error) and not (lt_rdyn) and not (not lt_rdyn AND not TS_DXFR));
	LW_LXFR_d = LCELL(
					(LW_IDLE and (TS_ADR_CLMD and not lt_rdyn and not cfg_cyc and wr_rdn and not serr_sig_set and lt_abortn and not retry))
					OR (LW_WAIT and not (data_timeout_error) and not (lt_rdyn) and not (not lt_rdyn AND not TS_DXFR))
				  
--				OR (LW_LXFR and not (TS_TURN_AR) and not (not lt_rdyn and not TS_DXFR and TS_DISC and irdy)  and not (lt_rdyn and irdy));
--				OR (LW_LXFR and not TS_TURN_AR and (lt_rdyn OR NOT TS_DISC OR NOT  irdy)  and (NOT lt_rdyn OR NOT irdy));

--				OR (LW_LXFR and not TS_TURN_AR and lt_rdyn   and NOT lt_rdyn );
--				OR (LW_LXFR and not TS_TURN_AR and NOT TS_DISC  and NOT lt_rdyn );
--				OR (LW_LXFR and not TS_TURN_AR and NOT  irdy  and NOT lt_rdyn );

--				OR (LW_LXFR and not TS_TURN_AR and lt_rdyn   and  NOT irdy);
--				OR (LW_LXFR and not TS_TURN_AR and NOT TS_DISC  and  NOT irdy);
--				OR (LW_LXFR and not TS_TURN_AR and NOT  irdy  and  NOT irdy);


--				OR (LW_LXFR and not TS_TURN_AR and NOT TS_DISC  and NOT lt_rdyn );
--				OR (LW_LXFR and not TS_TURN_AR and NOT TS_DISC  and  NOT irdy);
--				OR (LW_LXFR and not TS_TURN_AR and NOT  irdy);

					OR (LW_LXFR and not TS_TURN_AR and NOT TS_DISC  and NOT lt_rdyn )

				   )
				OR (LW_LXFR and not TS_TURN_AR and NOT  irdy );

--------- LW_WAIT_d Optimization ---------------------------------------------------------


--	LW_WAIT_d = (LW_LXFR and not (not lt_rdyn and not TS_DXFR and TS_DISC and irdy) and not (TS_TURN_AR) and (lt_rdyn and irdy and not TS_DISC))
--				OR (LW_WAIT and not (data_timeout_error) and (lt_rdyn));

	LW_WAIT_d = LCELL(
					(LW_WAIT and not (data_timeout_error) and (lt_rdyn))
				   )	
--					OR (LW_LXFR and not (TS_TURN_AR) and  (lt_rdyn or not TS_DISC or not irdy)  and (lt_rdyn and irdy and not TS_DISC)) ;

--					OR (LW_LXFR and not (TS_TURN_AR) and  (lt_rdyn  and lt_rdyn and irdy)) ;
--					OR (LW_LXFR and not (TS_TURN_AR) and  (not TS_DISC and lt_rdyn and irdy)) ;
--					OR (LW_LXFR and not (TS_TURN_AR) and  (not irdy  and lt_rdyn and irdy)) ;

--					OR (LW_LXFR and not (TS_TURN_AR) and  (lt_rdyn  and irdy)) ;
--					OR (LW_LXFR and not (TS_TURN_AR) and  (not TS_DISC and lt_rdyn and irdy)) ;

					OR LCELL(
							 (LW_LXFR and not TS_TURN_AR and lt_rdyn and not TS_DISC)
							) and irdy ;

---------- LW_DONE_d Optimization -------------------------------------------------------


--	LW_DONE_d = (LW_LXFR and  ((not lt_rdyn and not TS_DXFR and TS_DISC and irdy) or TS_TURN_AR))
--				OR (LW_WAIT and (data_timeout_error or (not lt_rdyn AND not TS_DXFR)) and not (lt_rdyn));

--	LW_DONE_d = (LW_WAIT and (data_timeout_error or (not lt_rdyn AND not TS_DXFR)) and not (lt_rdyn))
--				OR (LW_LXFR and  ((not lt_rdyn and TS_DISC and irdy) or TS_TURN_AR));

	LW_DONE_d = LCELL(
					(LW_WAIT and not (lt_rdyn) and data_timeout_error )
  	               		OR (LW_WAIT and not (lt_rdyn) AND not TS_DXFR )
						OR (LW_LXFR and  TS_

⌨️ 快捷键说明

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