Numărător pe 4 biți: Diferență între versiuni
Sari la navigare
Sari la căutare
Fără descriere a modificării |
|||
| (Nu s-au afișat 2 versiuni intermediare efectuate de același utilizator) | |||
| Linia 9: | Linia 9: | ||
-- https://en.wikibooks.org/wiki/VHDL_for_FPGA_Design/4-Bit_Binary_Counter_with_Parallel_Load | -- https://en.wikibooks.org/wiki/VHDL_for_FPGA_Design/4-Bit_Binary_Counter_with_Parallel_Load | ||
entity AAC2M2P1 is port ( | entity AAC2M2P1 is port ( -- toate astea sunt din documentația LS74163 | ||
CP: in std_logic; -- clock | CP: in std_logic; -- clock | ||
SR: in std_logic; -- Active low, synchronous reset | SR: in std_logic; -- Active low, synchronous reset | ||
| Linia 53: | Linia 53: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Link-uri externe== | ==Link-uri externe== | ||
* [https://www.coursera.org/learn/fpga-hardware-description-languages Hardware Description Languages for FPGA Design] | |||
* [https://www.mentor.com/products/fv/modelsim/ ModelSim] | * [https://www.mentor.com/products/fv/modelsim/ ModelSim] | ||
* [https://www.mentor.com/company/higher_ed/modelsim-student-edition ModelSim Student Edition] | * [https://www.mentor.com/company/higher_ed/modelsim-student-edition ModelSim Student Edition] | ||
==Cărți== | |||
* [https://plan.seek.intel.com/PSG_WW_NC_LPCD_FR_2018_FPGAforDummiesbook FPGAs For Dummies] | |||
Versiunea curentă din 1 februarie 2020 13:50
Acesta a fost unul dintre testele date în cursul de FPGA de la Coursera: reproducerea în FPGA a unui numărător LS74163. Simularea în ModelSim:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.ALL;
-- https://en.wikibooks.org/wiki/VHDL_for_FPGA_Design/4-Bit_Binary_Counter_with_Parallel_Load
entity AAC2M2P1 is port ( -- toate astea sunt din documentația LS74163
CP: in std_logic; -- clock
SR: in std_logic; -- Active low, synchronous reset
P: in std_logic_vector(3 downto 0); -- Parallel input = Data in
PE: in std_logic; -- Parallel Enable (Load)
CEP: in std_logic; -- Count enable parallel input, must be 1
CET: in std_logic; -- Count enable trickle input, must be 1
Q: out std_logic_vector(3 downto 0); -- Parallel output = Data out
TC: out std_logic -- Terminal Count/ RCO - ripple carry out
);
end AAC2M2P1;
architecture LS74163_A of AAC2M2P1 is
signal tmp_output : std_logic_vector(3 downto 0);
signal carry_on : std_logic;
begin
count_process : process (CP)
begin
if (CP'event and CP = '1') then
if (SR = '0') then
tmp_output <= (others => '0');
--carry_on <= '0';
else
if (PE = '0') then
tmp_output <= P;
--carry_on <= '0';
else
if (CEP = '1' and CET = '1') then
tmp_output <= tmp_output + 1;
if (tmp_output = "1111") then
carry_on <= '1';
else
carry_on <= '0';
end if;
end if;
end if;
end if;
end if;
end process count_process;
Q <= tmp_output;
TC <= carry_on;
end architecture LS74163_A;