Biologie | Chimie | Didactica | Fizica | Geografie | Informatica | |
Istorie | Literatura | Matematica | Psihologie |
Numarator
Codul
library ieee;
use ieee.std_logic_1164.all;
entity num4 is
port (clk : in std_logic;
rst : in std_logic;
num : buffer std_logic_vector(3 downto 0));
end num4;
architecture simul of num4 is
function inc_bv (a: std_logic_vector) return std_logic_vector is
variable r: std_logic_vector (a'range);
variable c: std_logic;
begin
c := '1';
for i in a'range loop
r(i) := a(i) xor c;
c := a(i) and c;
end loop;
return r;
end inc_bv;
begin
process (clk, rst)
begin
if (rst = '1') then
num <= (others => '0');
elsif (clk'event and clk = '1') then
num <= inc_bv (num);
end if;
end process;
end simul;
Afisarea rezultatelor simularii
Politica de confidentialitate |
Copyright © 2024 - Toate drepturile rezervate