library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_Arith.ALL;
use IEEE.STD_LOGIC_Unsigned.ALL;
Library UNISIM;
use UNISIM.vcomponents.all;
entity freq_div is
Port (clk_p, clk_n , rst, up, pause : in STD_LOGIC;
count : out STD_LOGIC_vector(3 downto 0));
end freq_div;
architecture Behavioral of freq_div is
signal clk2: std_logic;
signal cnt : std_logic_vector(3 downto 0):=(others=>'0');
signal clk: std_logic_vector(28 downto 0):=(others=>'0');
COMPONENT ila_1
PORT ( clk : IN STD_LOGIC;
probe0 : IN STD_LOGIC_VECTOR(3 DOWNTO 0));
END COMPONENT ;
begin
IBUFDS_inst : IBUFDS
generic map (
DIFF_TERM => FALSE, -- Differential Termination
IBUF_LOW_PWR => TRUE, -- Low power (TRUE) vs. performance (FALSE) setting for referenced I/O standards
IOSTANDARD => "DEFAULT")
port map (
O => clk2, -- Buffer output
I => clk_p, -- Diff_p buffer input (connect directly to top-level port)
IB => clk_n -- Diff_n buffer input (connect directly to top-level port)
);
process(clk2, rst)
begin
if (rst = '1')then
clk <= (others=>'0');
elsif (clk2'event and clk2 = '1')then
clk <= clk + 1;
end if;
end process;
process(clk(25), rst,up,pause)
begin
if (rst = '1') then
cnt <= (others=>'0');
elsif (clk(25) = '1' and clk(25)'event) then
if (up = '1' and pause = '0')then
cnt <= cnt + '1';
elsif (up = '0' and pause = '0') then
cnt <= cnt - '1';
elsif( pause ='1')then
cnt <= cnt;
end if;
end if;
end process;
count <= cnt;
U1 : ila_1 PORT MAP ( clk => clk2 , probe0 => cnt );
end Behavioral;
Estamos utilizando la placa zynq (zc702). En la placa zynq tenemos dos relojes: un reloj positivo (clk_p) y un reloj negativo (clk_n) .... Puedo ver una mención de estos dos relojes como en std_logic, pero no entiendo cómo han usado estos relojes en el programa ... es decir, ¿cómo han integrado estos dos relojes en el programa?
¿También qué es clk (25)?
También mencione el funcionamiento del código. Hemos entendido que el código se usa para contar hacia arriba y hacia abajo. No entendemos la siguiente parte:
architecture Behavioral of freq_div is
signal clk2: std_logic;
signal cnt : std_logic_vector(3 downto 0):=(others=>'0');
signal clk: std_logic_vector(28 downto 0):=(others=>'0');
COMPONENT ila_1
PORT ( clk : IN STD_LOGIC;
probe0 : IN STD_LOGIC_VECTOR(3 DOWNTO 0));
END COMPONENT ;
begin
IBUFDS_inst : IBUFDS
generic map (
DIFF_TERM => FALSE, -- Differential Termination
IBUF_LOW_PWR => TRUE, -- Low power (TRUE) vs. performance (FALSE) setting for referenced I/O standards
IOSTANDARD => "DEFAULT")
port map (
O => clk2, -- Buffer output
I => clk_p, -- Diff_p buffer input (connect directly to top-level port)
IB => clk_n -- Diff_n buffer input (connect directly to top-level port)
);