Ejemplos VHDL Latch: Ieee Ieee STD - LOGIC - 1164
Ejemplos VHDL Latch: Ieee Ieee STD - LOGIC - 1164
Latch
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity latch is
Port ( D, clk : IN STD_LOGIC;
Q : OUT STD_LOGIC);
end latch;
if clk='1'then
Q <= D;
end if;
end process;
end Behavior;
Biestable D
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity flipflop is
Port ( D, clk : IN STD_LOGIC;
Q : OUT STD_LOGIC);
end flipflop;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity flipflop is
Port ( clk : IN STD_LOGIC;
D : IN STD_LOGIC_VECTOR(7 downto 0);
Q : OUT STD_LOGIC(7 downto 0));
end flipflop;
Memoria ROM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity myROM is
Port ( clk : IN STD_LOGIC;
address : IN STD_LOGIC_VECTOR(11 downto 0);
data_out : OUT STD_LOGIC VECTOR(7 downto 0));
end myROM;
Memoria RAM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity myRAM is
Port ( clk : IN STD_LOGIC;
we : IN STD_LOGIC;
address : IN STD_LOGIC_VECTOR(11 downto 0);
data_in : IN STD_LOGIC VECTOR(7 downto 0);
data_out : OUT STD_LOGIC VECTOR(7 downto 0));
end myROM;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity contador is
port ( clk : IN STD_LOGIC;
reset : IN STD_LOGIC;
load : IN STD_LOGIC;
data : IN STD_LOGIC VECTOR(3 downto 0);
cnt_out : OUT STD_LOGIC VECTOR(3 downto 0));
end contador;
División de frecuencia
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
entity div_clk is
port ( reset : IN STD_LOGIC;
clk : IN STD_LOGIC;
clk_out : OUT STD_LOGIC);
end div_clk;
begin
gen_clock: process (clk, reset) is
begin
if (reset = '0') then
clk_cnt <= "00000000000000000000000000"; -- <= (others =>
'0')
clk_bit <= '0';
elsif (clk'event and clk='1') then
if (clk_cnt = 49999999) then
ck_cnt <= "00000000000000000000000000"; -- <= (others
=> '0')
clk_bit <= not clk_bit;
else
clk_cnt <= clk_cnt + 1;
end if;
end if;
end process;
clk_out <= clk_bit;
end arch;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
entity delay_clock is
port (
Clk50Mhz: in STD_LOGIC;
Clk: out STD_LOGIC
);
end delay_clock;
begin
process
begin
wait until Clk50Mhz'event and Clk50Mhz = '1';
if count < max then
count <= count + 1;
else
count <= 0;
end if;
library ieee;
use IEEE.std_logic_1164.all;
entity fsm_mealy is
port (clk : in std_logic;
reset : in std_logic;
input : in std_logic;
output : out std_logic
);
end fsm_mealy;
begin
process (clk,reset)
begin
if (reset='1') then
current_s <= s0; --Estado inicial.
elsif (rising_edge(clk)) then --o elsif (clk'event and clk = '1')
then
current_s <= next_s; --Cambio de estado.
end if;
end process;
end behavioral;