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

📄 hostmot5-4e.vhd

📁 Source code for an Numeric Cmputer
💻 VHD
📖 第 1 页 / 共 2 页
字号:
		reset => '0',		loadgcr => LoadGCRCmd,		ctrclear => GlobalCounterClear,		ctrlatch => GlobalCountLatchCmd,		pwmclear => GlobalClearPWMCmd,		irqclear => ClearIRQCmd,		reloadwd => ReloadWDCmd		);	gglobalmodereg: globalmodereg port map (		clk => LClk,		ibus => LAD(15 downto 0),		obus => D(15 downto 0),		reset => '0',		loadglobalmode => loadGMRCmd,		readglobalmode => ReadGMRCmd,		ctrena => GlobalCounterEnable,		pwmena => GlobalPWMEnable,		clearpwmena => StopPWM,		loi => LatchOnInterrupt,		som => StopOnMissedIRQ,		sot => StopOnTimeout,		miout	=> ClearMissedIRQ,		miin => MissedIRQ,		irqmask => IRQMask,		irqstatus => IRQLatch		);    atimeout: timeout port map ( 	 	clk => LClk,      ibus => LAD(15 downto 0),       obus => D(15 downto 0),      timeoutload	 => loadTimeOutCmd,      timeoutread => ReadTimeOutCmd,      timerread => ReadTimerCmd,      reload => ReLoadWDCmd,      timerz => WDTimeout		 );	LADDrivers: process (D,FastRead)	begin 		if FastRead ='1' then				LAD <= D;		else			LAD <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";					end if;	end process LADDrivers;	AddressLatch: process (lclk)	begin		if lclk'event and LClk = '1' then	  		if ADS = '0' then	  			LatchedA <= LAD(15 downto 0);				LatchedLBE <= LBE;			end if;		end if;	end process AddressLatch;	-- we generate an early read from ADS and LR_W	-- since the 10 nS LRD delay and 5 nS setup time 	-- only give us 15 nS to provide data to the PLX chip		MakeFastRead: process (lclk,PreFastread,LRD)	begin		if lclk'event and LClk = '1' then			if ADS = '0' and LW_R = '0'then				PreFastRead <= '1';			else 				PreFastRead <= '0'; 			end if;		end if;		FastRead <= PreFastRead or (not LRD);	end process MakeFastRead;			Decode: process (LatchedA) 	begin 			if LatchedA(7 downto 5) = "000" then 	 -- 32 bit access			CounterSel <= '1'; 		else 			CounterSel <= '0';		end if;				if LatchedA(7 downto 5) = "001" then 	 -- 32 bit access			SCounterSel <= '1'; 		else 			SCounterSel <= '0';		end if;						if LatchedA(7 downto 4) = "0100" then    -- 16 bit access			CCRSel <= '1'; 		else 			CCRSel <= '0';		end if;					if LatchedA(7 downto 4) = "0101" then    -- 16 bit access			SCCRSel <= '1'; 		else 			SCCRSel <= '0';		end if;			 		if LatchedA(7 downto 5) = "011" then 		 -- 16 bit access			PWMValSel <= '1'; 		else 			PWMValSel <= '0';		end if;				 		if LatchedA(7 downto 5) = "100" then 		-- 16 bit access			PCRSel <= '1'; 		else 			PCRSel <= '0';		end if;		  		if LatchedA(7 downto 2) = "101000" then 		-- 32 bit access			PortASel <= '1'; 		else 			PortASel <= '0';		end if;		   		if LatchedA(7 downto 2) = "101001" then 		-- 32 bit access			DDRASel <= '1'; 		else 			DDRASel <= '0';		end if;		   		if LatchedA(7 downto 2) = "101010" then 		-- 32 bit access			PortBSel <= '1'; 		else 			PortBSel <= '0';		end if;		   		if LatchedA(7 downto 2) = "101011" then 		-- 32 bit access			DDRBSel <= '1'; 		else 			DDRBSel <= '0';		end if;		 		if LatchedA(7 downto 1) = "1100000"  then 	-- 16 bit access			GCRSel <= '1'; 		else 			GCRSel <= '0';		end if;					if LatchedA(7 downto 1) = "1100001" then 		-- 16 bit access			GMRSel <= '1'; 											else 			GMRSel <= '0';		end if;								if LatchedA(7 downto 1) = "1100010"then 	  -- 16 bit access			IRQDivSel <= '1'; 		else 			IRQDivSel <= '0';		end if;		 		if LatchedA(7 downto 1) = "1100011"then 	  -- 16 bit access			PhaseSel <= '1'; 		else 			PhaseSel <= '0';		end if;				if LatchedA(7 downto 1) = "1100100" then 		-- 16 bit access			TimeOutSel <= '1'; 		else 			TimeOutSel <= '0';		end if;							if LatchedA(7 downto 1) = "1100101" then 		-- 16 bit access			TimerSel <= '1'; 		else 			TimerSel <= '0';		end if;							if LatchedA(7 downto 1) = "1100110" then 		-- 16 bit access			LEDViewSel <= '1'; 		else 			LEDViewSel <= '0';		end if;							end process;											SigsOut: process (EnaSigs)	begin		Ena <= EnaSigs;	end process;		CounterDecode: process (CounterSel, Fastread, LatchedA) 	begin 		if FastRead = '1' then			CounterRead <= OneOfFourDecode(CounterSel,LatchedA(3 downto 2)); 		else			CounterRead <= (others => '0');		end if;	end process;		SCounterDecode: process (SCounterSel, Fastread, LatchedA) 	begin 		if FastRead = '1' then			SCounterRead <= OneOfFourDecode(SCounterSel,LatchedA(3 downto 2)); 		else			SCounterRead <= (others => '0');		end if;	end process;		CCRegs: process (CCRSel, FastRead, LWR, LatchedA) 	begin  		if FastRead = '1' then			CCRReadCmds <= OneOfFourDecode(CCRSel,LatchedA(2 downto 1)); 		else			CCRReadCmds <= (others => '0');		end if;		if LWR = '0' then			CCRLoadCmds <= OneOfFourDecode(CCRSel,LatchedA(2 downto 1)); 		else			CCRLoadCmds <= (others => '0');		end if;	end process;		SCCRegs: process (SCCRSel, FastRead, LWR, LatchedA) 	begin  		if FastRead = '1' then			SCCRReadCmds <= OneOfFourDecode(SCCRSel,LatchedA(2 downto 1)); 		else			SCCRReadCmds <= (others => '0');		end if;		if LWR = '0' then			SCCRLoadCmds <= OneOfFourDecode(SCCRSel,LatchedA(2 downto 1)); 		else			SCCRLoadCmds <= (others => '0');		end if;	end process;	  	PWMdecode: process (PWMValSel,Fastread, LWR, LatchedA) 	begin 		if FastRead = '1' then			ReadPWM <= OneOfFourDecode(PWMValSel,LatchedA(2 downto 1)); 		else			ReadPWM <= (others => '0');		end if; 					if LWR = '0' then			LoadPWM <= OneOfFourDecode(PWMValSel,LatchedA(2 downto 1)); 		else			LoadPWM <= (others => '0');		end if; 			end process;	 	PCRegs: process (PCRSel,Fastread, LWR, LatchedA) 	begin 		if FastRead = '1' then			PCRReadCmds <= OneOfFourDecode(PCRSel,LatchedA(2 downto 1)); 		else			PCRReadCmds <= (others => '0');		end if; 					if LWR = '0' then			PCRLoadCmds <= OneOfFourDecode(PCRSel,LatchedA(2 downto 1)); 		else			PCRLoadCmds <= (others => '0');		end if; 			end process;		PortADecode: process (PortASel,FastRead,LWR)	begin		if PortASel = '1' and LWR = '0' then 			LoadPortA <= '1';		else 			LoadPortA <= '0';		end if;		if PortASel = '1' and FastRead = '1' then 			ReadPortA <= '1';		else 			ReadPortA <= '0';		end if;	end process PortADecode; 	DDRADecode: process (DDRASel,FastRead,LWR)	begin		if DDRASel = '1' and LWR = '0' then 			LoadDDRA <= '1';		else 			LoadDDRA <= '0';		end if;		if DDRASel = '1' and FastRead = '1' then 			ReadDDRA <= '1';		else 			ReadDDRA <= '0';		end if;	end process DDRADecode;	PortBDecode: process (PortBSel,FastRead,LWR)	begin		if PortBSel = '1' and LWR = '0' then 			LoadPortB <= '1';		else 			LoadPortB <= '0';		end if;		if PortBSel = '1' and FastRead = '1' then 			ReadPortB <= '1';		else 			ReadPortB <= '0';		end if;	end process PortBDecode; 	DDRBDecode: process (DDRBSel,FastRead,LWR)	begin		if DDRBSel = '1' and LWR = '0' then 			LoadDDRB <= '1';		else 			LoadDDRB <= '0';		end if;		if DDRBSel = '1' and FastRead = '1' then 			ReadDDRB <= '1';		else 			ReadDDRB <= '0';		end if;	end process DDRBDecode;	GCRDecode: process (GCRSel,LWR)	begin		if GCRSel = '1' and LWR = '0' then 			LoadGCRCmd <= '1';		else 			LoadGCRCmd <= '0';		end if;	end process GCRDecode;	GMRDecode: process (GMRSel,FastRead,LWR)	begin		if GMRSel = '1' and LWR = '0' then 			LoadGMRCmd <= '1';		else 			LoadGMRCmd <= '0';		end if;		if GMRSel = '1' and FastRead = '1' then 			ReadGMRCmd <= '1';		else 			ReadGMRCmd <= '0';		end if;	end process GMRDecode;	TimeOutDecode: process (TimeOutSel,FastRead,LWR)	begin		if TimeoutSel = '1' and LWR = '0' then 			LoadTimeOutCmd <= '1';		else 			LoadTimeOutCmd <= '0';		end if;		if TimeOutSel = '1' and FastRead = '1' then 			ReadTimeOutCmd <= '1';		else 			ReadTimeOutCmd <= '0';		end if;	end process TimeOutDecode;	TimerDecode: process (TimerSel,FastRead,LWR)	begin		if TimerSel = '1' and FastRead = '1' then 			ReadTimerCmd <= '1';		else 			ReadTimerCmd <= '0';		end if;	end process TimerDecode;		LEDViewDecode: process (LedViewSel,FastRead,LWR)	begin		if LEDViewSel = '1' and LWR = '0' then 			LoadLEDViewCmd <= '1';		else 			LoadLEDViewCmd <= '0';		end if;		if LEDViewSel = '1' and FastRead= '1' then 			ReadLEDViewCmd <= '1';		else 			ReadLEDViewCmd <= '0';		end if;	end process LEDViewDecode;		IRQDivDecode: process (IRQDivSel,FastRead,LWR)	begin		if IRQDivSel = '1' and LWR = '0' then 			LoadIRQDivCmd <= '1';		else 			LoadIRQDivCmd <= '0';		end if;		if IRQDivSel = '1' and FastRead = '1' then 			ReadIRQDivCmd <= '1';		else 			ReadIRQDivCmd <= '0';		end if;	end process IrqDivDecode;	PhaseDecode: process (PhaseSel,FastRead,LWR)	begin		if PhaseSel = '1' and LWR = '0' then 			LoadPhaseCmd <= '1';		else 			LoadPhaseCmd <= '0';		end if;		if PhaseSel = '1' and FastRead = '1' then 			ReadPhaseCmd <= '1';		else 			ReadPhaseCmd <= '0';		end if;	end process PhaseDecode;	irqlogic: process (CardSelect,							IRQSource, 							IrqLatch, 							ClearMissedIRQ,							MissedIRQ,							StopOnMissedIRQ,							LatchOnInterrupt,							GlobalCountLatchCmd,							GlobalClearPWMCmd,							ClearIRQCmd)	begin		 		if IrqSource'event and IRQsource = '1' then			IRQLatch <= '1';			if IRQLatch = '1' then 	-- if IRQLatch is set and we get the next interrupt				MissedIRQ <= '1';		-- set Missed IRQ latch				end if;					end if;		if LClk'event and LClk = '1' then			if ((IRQLatch = '1') and (LatchOnInterrupt = '1')) or (GlobalCountLatchCmd = '1') then				CountLatchEdge1 <= '1';			else				CountLatchEdge1 <= '0';			end if;			CountLatchEdge2 <= 	CountLatchEdge1;			if  CountLatchEdge2 = '0' and	CountLatchEdge1 = '1' then				GlobalCountLatch <= '1';			else				GlobalCountLatch <= '0';		 	end if;		end if;		if ClearMissedIRQ = '1' then 			MissedIRQ <= '0';		end if;		if ((MissedIRQ = '1') and (StopOnMissedIRQ = '1')) or			((WDTimeOut = '1') and (StopOnTimeout = '1')) then			StopPWM <= '1';		else 			StopPWM <= '0';		end if;				if (StopPWM = '1') or (GlobalClearPWMCmd = '1') then  -- either stop on pwm or global clear reset pwm gens			GlobalClearPWM <= '1';		else			GlobalClearPWM <= '0';		end if;					if ClearIRQCmd = '1' then  --  clear IRQ 	   	IRQLatch <= '0';		end if;				Int <=  not (IRQLatch and IRQMask);	-- drive our (active low) interrupt pin		Ready <= '0';				-- We're always ready			end process;	LEDDrive: process (A,B,Idx,Dir,PWM,IRQLatch,LedView) 	begin 			LEDS(7) <= not IRQLatch;		LEDS(6) <= not OneOfFourMux(LEDView(1 downto 0),A);		LEDS(5) <= not OneOfFourMux(LEDView(1 downto 0),B);		LEDS(4) <= not OneOfFourMux(LEDView(1 downto 0),Idx);		LEDS(3) <= not OneOfFourMux(LEDView(1 downto 0),Dir);		LEDS(2) <= not OneOfFourMux(LEDView(1 downto 0),PWM);		LEDS(1) <= OneOfFourMux(LEDView(1 downto 0),EnaSigs);		LEDS(0) <= not WDTimeout;			end process leddrive;end dataflow;  

⌨️ 快捷键说明

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