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

📄 sim34c60.vhd

📁 TDS510USB2.0接口DSP仿真器.rar
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;

--  FF condition equal          "11100"
--  87 condition equal          "11011
--  78 condition equal          "01110"
--  Condition Selected          "11110"        
entity sim34c60 is
       port(
             ParallelP: inout STD_LOGIC_VECTOR(7 downto 0):= "ZZZZZZZZ" ;
             ISAbus: inout STD_LOGIC_VECTOR(15 downto 0):="ZZZZZZZZZZZZZZZZ";
             Status: out STD_LOGIC_VECTOR(4 downto 0) := "11111";
             nStrobe:   in std_logic;
             nAfd:      in std_logic;
             nInit:     in std_logic;
             nSelectIn: in std_logic;
       --      Reset:     in std_logic;
         RD: buffer std_logic :='1';
        WR: out std_logic := '1';
		  RClk: buffer std_logic :='0';
      OutputRegisterP: buffer std_logic_vector(7 downto 0) := "11111111";
      AddressPort: out std_logic_vector(7 downto 0);
      InputRegister: in std_logic_vector(1 downto 0) 
           );
end sim34c60;

  
architecture struct of sim34c60 is
          
signal bSelected:  std_logic :='0';
signal Address: std_logic_vector(7 downto 0);
signal WriteClk:  std_logic :='0';
signal tmp:      std_logic_vector(7 downto 0) := "11111111";

begin 
      
                             
    
 
          -- **************** Daisy Chain Protocol *******************************************
   process(Parallelp)
  begin
            
            if (ParallelP = "11111111" ) then   -- condition FF
                                Status <= "11100";
            elsif (ParallelP =  "10000111" ) then  -- condition 87
                                 Status <= "11011";
           elsif (ParallelP = "01111000" ) then  -- condition 78
                                 Status <= "01110";
           elsif(ParallelP = "11100000" ) then   -- command E0 -> select in comp mode
                                Status <= "11110";
                                bSelected <= '1'; 
           elsif(ParallelP = "00110000" ) then     -- command 30 -> deselect all
                                Status <= "01110";
                                --bSelected <='0';
           elsif(ParallelP = "00000000" and bSelected = '1') then  -- command 00 -> assign 00 addr
                                 Status <= "01110";                                                 
          end if;
        -- ******************** END Daisy Chain Protocol ***********************************  
           
       end process;      
 --******************* Process clk signals *****************************************

 process (nStrobe) 
 begin

    
   --=============================================================================   
      
    if(nStrobe'event and  nStrobe = '0' )then  -- nStrobe signal down 

       if(Address = "11110010") then    -- case F2 output register
        OutputRegisterP(0) <= not ParallelP(0);
        OutputRegisterP(1) <= not ParallelP(1);
        OutputRegisterP(2) <= not ParallelP(2);
        OutputRegisterP(3) <= not ParallelP(3);
        OutputRegisterP(4) <= not ParallelP(4);
        OutputRegisterP(5) <= not ParallelP(5);
        OutputRegisterP(6) <= not ParallelP(6);
        OutputRegisterP(7) <=     ParallelP(7);
     elsif(Address = "11110000") then  
                                  AddressPort <= ParallelP; -- case F0 writing to Addres
                                 ISABus<="ZZZZZZZZZZZZZZZZ";
     elsif(Address = "11100000" ) then  
                                    if(WriteClk = '0' )then
                                           WriteClk <= '1';
														 ISABus(7 downto 0) <= ParallelP;
                                           
                   
                                   elsif(WriteClk = '1') then 
											         WriteClk <='0'; 
                                          ISABus(15 downto 8) <= ParallelP;
                                          
                 
                                   end if;
	  	 elsif(Address = "10100000" ) then
                                        if (RClk = '0') then RClk <='1';
													 elsif(RClk = '1')then  RClk <= '0';
													 end if;
												   

      end if;
  
   end if;          
   --=========================================================================
   if(rising_edge(nStrobe)) then 
                                 if(WriteClk = '1')then WR <= '0';
                                 elsif(WriteClk = '0')then WR <= '1';
											end if;
 
           									    
   end if;
   --=========================================================================

 
  end process;
  --****************************** end process nStrobe *******************************
  --******************************  process nSelectIn *******************************
  process (nSelectIn)
  begin
      if( nSelectIn'event and nSelectIn ='0') then      -- Process Address Signal  down
          Address <= ParallelP;
	
    end if;  
 end process;
  --******************************  end process nSelectIn *******************************

  --******************************  process nInit *******************************
process (nInit)
begin
	  if (  nInit = '0' )then      -- read Signal down
  --======================================================  
      if(Address = "10110010") then
         ParallelP(0) <= not OutputRegisterP(0);  -- B2 ReadOutputRegister
         ParallelP(1) <= not OutputRegisterP(1);
         ParallelP(2) <= not OutputRegisterP(2);
         ParallelP(3) <= not OutputRegisterP(3);
         ParallelP(4) <= not OutputRegisterP(4);
         ParallelP(5) <= not OutputRegisterP(5);
         ParallelP(6) <= not OutputRegisterP(6);
         ParallelP(7) <=     OutputRegisterP(7);
       
         --====================================================
      elsif(Address = "10110011") then      -- B3 Read input register            
               for i in 0 to 1 loop
					   if InputRegister(i) = '1' then ParallelP (i)<= '1'; 
						else ParallelP(i) <= '0';
						end if;
					end loop;	                                              
      
      elsif(Address = "10100000")then
                            RD <='0';
                            if ( RClk = '0')  then 
                 					  		  for i in 0 to 7 loop
													  if  ISABus(i)= '1' then ParallelP(i) <= '1';
													  else ParallelP(i) <='0';
													  end if;
													end loop;
	                          elsif ( RClk = '1') then 
	                                     for j in 8 to 15 loop
														if ISABus(j) = '1' then ParallelP(j-8) <= '1';--ISABus (15 downto 8);
														else ParallelP(j-8) <= '0';
														end if;
													 end loop;
										end if;
	  end if;
									 				  
    

 --  --=====================================================
   elsif(nInit = '1') then 
                        ParallelP <="ZZZZZZZZ";				 
                        RD<='1';
	
   
   end if;
  end process;

	  --******************************  end process nInit *******************************



  
 end struct;        



 

⌨️ 快捷键说明

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