Jump to content

    

Управление PHY через MDC/MDIO

Делал. Работало.

 

Вот Вам пример. Конфигурирование PHY на 100М линк

----------------------------------------------------------------------------------

entity mii_mem is
    Port ( clk     : in  STD_LOGIC;
           en     : in  STD_LOGIC;
           addr : in  STD_LOGIC_VECTOR (6 downto 0);
           do     : out  STD_LOGIC
        );
end mii_mem;

architecture Behavioral of mii_mem is
  type rom_type is array (0 to 127) of std_logic;
  signal rom : rom_type := 
  (
    --preambl
    '1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1',
    --ST
    '0','1',
    --OP CODE
    '0','1',
    --PHY ADDR
    '0','0','0','0','0',
    --REG ADDR
    '0','0','0','0','0',
    --TAR
    '1','0',
    --DATA
    '0','0','1','0','0','0','0','0',
    --DATA
    '0','0','0','0','0','0','0','0',
    --post
    --'1','1','1','1',
    --preambl
    '1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1',
    --ST
    '0','1',
    --OP CODE
    '0','1',
    --PHY ADDR
    '0','0','0','0','0',
    --REG ADDR
    '0','0','0','0','0',
    --TAR
    '1','0',
    --DATA
    '1','0','1','0','0','0','0','0',
    --DATA
    '0','0','0','0','0','0','0','0'
    --post
    --'1','1','1','1'    
    );
    
attribute rom_style: string;
attribute rom_style of rom: signal is "distributed";

begin
  process(clk)
  begin
    if clk'event and clk = '1' then
      if en = '1' then
        do <= rom(conv_integer(addr));
      end if;
    end if;
  end process;

end Behavioral;

 

сигнал addr инкрементирутся по каждому clk

 

 

простите, а нет ли у вас примера для слейва?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this