dio cane
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
library IEEE;
|
||||
use IEEE.numeric_bit.all;
|
||||
|
||||
entity Sim_CSA16 is
|
||||
end Sim_CSA16;
|
||||
|
||||
architecture MySim_CSA16 of Sim_CSA16 is
|
||||
component CSA16_2x8
|
||||
Port (A,B: in bit_vector(15 downto 0);
|
||||
cin: in bit;
|
||||
S: out bit_vector(15 downto 0);
|
||||
cout: out bit);
|
||||
end component;
|
||||
component CSA16_4x4
|
||||
Port (A,B: in bit_vector(15 downto 0);
|
||||
cin: in bit;
|
||||
S: out bit_vector(15 downto 0);
|
||||
cout: out bit);
|
||||
end component;
|
||||
|
||||
signal IA,IB,OS1,OS2: bit_vector(15 downto 0);
|
||||
signal Icin, Ocout1,Ocout2: bit;
|
||||
|
||||
begin
|
||||
CUT1: CSA16_2x8 port map(IA,IB,Icin,OS1,Ocout1);
|
||||
CUT2: CSA16_4x4 port map(IA,IB,Icin,OS2,Ocout2);
|
||||
process begin
|
||||
Icin <= '0';
|
||||
for j in 65279 to 65535 loop
|
||||
for k in 65279 to 65535 loop
|
||||
IA <= bit_vector(to_signed(j,16));
|
||||
IB <= bit_vector(to_signed(k,16));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
Icin <= '1';
|
||||
for j in 65279 to 65535 loop
|
||||
for k in 65279 to 65535 loop
|
||||
IA <= bit_vector(to_signed(j,16));
|
||||
IB <= bit_vector(to_signed(k,16));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
wait;
|
||||
end process;
|
||||
|
||||
end MySim_CSA16;
|
||||
@@ -0,0 +1,47 @@
|
||||
entity Sim_FullAdder is
|
||||
end Sim_FullAdder;
|
||||
|
||||
architecture MySim_FullAdder of Sim_FullAdder is
|
||||
component FullAdder is
|
||||
Port ( a,b,cin : in bit;
|
||||
s,cout : out bit);
|
||||
end component;
|
||||
|
||||
signal Ia, Ib, Icin, Os, Ocout: bit;
|
||||
begin
|
||||
CUT: FullAdder port map(Ia, Ib, Icin, Os, Ocout);
|
||||
process begin
|
||||
Ia <= '0';
|
||||
Ib <= '0';
|
||||
Icin <= '0';
|
||||
wait for 10ns;
|
||||
Ia <= '1';
|
||||
Ib <= '0';
|
||||
Icin <= '0';
|
||||
wait for 10ns;
|
||||
Ia <= '0';
|
||||
Ib <= '1';
|
||||
Icin <= '0';
|
||||
wait for 10ns;
|
||||
Ia <= '0';
|
||||
Ib <= '0';
|
||||
Icin <= '1';
|
||||
wait for 10ns;
|
||||
Ia <= '1';
|
||||
Ib <= '1';
|
||||
Icin <= '0';
|
||||
wait for 10ns;
|
||||
Ia <= '1';
|
||||
Ib <= '0';
|
||||
Icin <= '1';
|
||||
wait for 10ns;
|
||||
Ia <= '0';
|
||||
Ib <= '1';
|
||||
Icin <= '1';
|
||||
wait for 10ns;
|
||||
Ia <= '1';
|
||||
Ib <= '1';
|
||||
Icin <= '1';
|
||||
end process;
|
||||
|
||||
end MySim_FullAdder;
|
||||
@@ -0,0 +1,37 @@
|
||||
library IEEE;
|
||||
use IEEE.numeric_bit.all;
|
||||
|
||||
entity Sim_RCA4 is
|
||||
end Sim_RCA4;
|
||||
|
||||
architecture MySim_RCA4 of Sim_RCA4 is
|
||||
component RCA4 is
|
||||
Port (A,B: in bit_vector(3 downto 0);
|
||||
cin: in bit;
|
||||
S: out bit_vector(3 downto 0);
|
||||
cout: out bit);
|
||||
end component;
|
||||
|
||||
signal IA,IB,OS: bit_vector(3 downto 0);
|
||||
signal Icin, Ocout: bit;
|
||||
begin
|
||||
CUT: RCA4 port map(IA,IB,Icin,OS,Ocout);
|
||||
process begin
|
||||
Icin <= '0';
|
||||
for j in 0 to 15 loop
|
||||
for k in 0 to 15 loop
|
||||
IA <= bit_vector(to_signed(j,4));
|
||||
IB <= bit_vector(to_signed(k,4));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
Icin <= '1';
|
||||
for j in 0 to 15 loop
|
||||
for k in 0 to 15 loop
|
||||
IA <= bit_vector(to_signed(j,4));
|
||||
IB <= bit_vector(to_signed(k,4));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
end process;
|
||||
end MySim_RCA4;
|
||||
@@ -0,0 +1,37 @@
|
||||
library IEEE;
|
||||
use IEEE.numeric_bit.all;
|
||||
|
||||
entity Sim_RCA8 is
|
||||
end Sim_RCA8;
|
||||
|
||||
architecture MySim_RCA8 of Sim_RCA8 is
|
||||
component RCA8 is
|
||||
Port (A,B: in bit_vector(7 downto 0);
|
||||
cin: in bit;
|
||||
S: out bit_vector(7 downto 0);
|
||||
cout: out bit);
|
||||
end component;
|
||||
|
||||
signal IA,IB,OS: bit_vector(7 downto 0);
|
||||
signal Icin, Ocout: bit;
|
||||
begin
|
||||
CUT: RCA8 port map(IA,IB,Icin,OS,Ocout);
|
||||
process begin
|
||||
Icin <= '0';
|
||||
for j in 0 to 255 loop
|
||||
for k in 0 to 255 loop
|
||||
IA <= bit_vector(to_signed(j,8));
|
||||
IB <= bit_vector(to_signed(k,8));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
Icin <= '1';
|
||||
for j in 0 to 255 loop
|
||||
for k in 0 to 255 loop
|
||||
IA <= bit_vector(to_signed(j,8));
|
||||
IB <= bit_vector(to_signed(k,8));
|
||||
wait for 10ns;
|
||||
end loop;
|
||||
end loop;
|
||||
end process;
|
||||
end MySim_RCA8;
|
||||
Reference in New Issue
Block a user