Projekty projekt pakiet


library IEEE;
use IEEE.STD_LOGIC_1164.all;

package pakiet is

component rejestr_D is -- rejestr na przerzutnikach D
generic (n : integer :=5);
port( clk,reset,load : in STD_LOGIC;
d : in STD_LOGIC_VECTOR(n-1 downto 0);
q : out STD_LOGIC_VECTOR(n-1 downto 0) );
end component rejestr_D;

component konw_1zn is -- konwerter kodu z bin na 1zN
port( a : in std_logic_vector(2 downto 0);
led : out std_logic_vector(7 downto 0) );
end component konw_1zn;

component licz_synchr is -- licznik synchroniczny
generic (n : integer :=8);
port( clk,reset,set,dir: in STD_LOGIC;
q : out std_logic_vector(n-1 downto 0) );
end component licz_synchr;

end package pakiet;


library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity rejestr_D is
generic (n : integer :=5);
port( clk,reset,load : in STD_LOGIC;
d : in STD_LOGIC_VECTOR(n-1 downto 0);
q : out STD_LOGIC_VECTOR(n-1 downto 0) );
end rejestr_D;

architecture rejestr_D of rejestr_D is

begin
process(clk,reset) begin
if reset='1' then q <= (others => '0');
elsif (clk='1' and clk'event) then
if load='1' then q <= d;
end if;
end if;
end process;
end rejestr_D;


library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity konw_1zn is
port( a : in std_logic_vector(2 downto 0);
led : out std_logic_vector(7 downto 0) );
end konw_1zn;

architecture konw_1zn of konw_1zn is

begin
led <= "00000001" when a="000" else
"00000010" when a="001" else
"00000100" when a="010" else
"00001000" when a="011" else
"00010000" when a="100" else
"00100000" when a="101" else
"01000000" when a="110" else
"10000000" when a="111";
end konw_1zn;


library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity licz_synchr is
generic (n : integer :=8);
port( clk,reset,set,dir: in STD_LOGIC;
q : out std_logic_vector(n-1 downto 0) );
end licz_synchr;

architecture licz_synchr of licz_synchr is

signal qs : std_logic_vector(n-1 downto 0);

begin
process (clk,reset,set,dir) begin
if (reset='1') then qs <= (others=>'0');
elsif (set='1') then qs <= (others=>'1');
elsif (clk'event and clk='1') then
if dir='1' then qs <= qs + 1;
else qs <= qs - 1;
end if;
end if;
end process;
q <= qs;
end licz_synchr;

Wyszukiwarka

Podobne podstrony:
32$1303 projektant pakietow uslug finansowych
Projekty pamiec pakiet
Pakiet projektowy EDWin
Pakiet do projektowania instalacji grzewczych
Projekt pracy aparat ortodontyczny ruchomy
Projekt mgif
projekt z budownictwa energooszczednego nr 3
prasa dwukolumnowa projekt
4 projekty
Cuberbiller Kreacjonizm a teoria inteligentnego projektu (2007)

więcej podobnych podstron