Sie sind auf Seite 1von 2

Leopando, Keilla Marie R.

ECE240-Advanced Digital IC

MEP-ECE 4Q-18-19 Assignment

architecture Behavioral of BitCount is

begin

process (CLK)

variable count_bit: natural:=0;

begin

if CLK=’1’ and CLK’event then

for i in 0 to 15 loop

if INA(i)=’1’ then

count_bit <= count_bit + 1;

count_bit := count_bit + 1;

end if;

end loop;

OUTA <= count_bit;

OUTA <= conv_std_logic_vector(count_bit,5);

end if;

num_bit:=0;

end process;

end Behavioral;
architecture Behavioral of Arithmetic_Div_Mod is

begin

process (CLK)

variable answer: natural :=0;

begin

if CLK=’1’ and CLK’event then

if INC = ‘1’ then

if conv_integer(INB) = 0 then

EF <= ‘1’;

answer := 0;

else

EF <= ‘0’;

answer := conv_integer(INA)/conv_integer(INB);

endif;

else

if conv_integer(INB) = 0 then

EF <= ‘1’;

answer := 0;

else

EF <= ‘0’;

answer := conv_integer(INA) mod conv_integer(INB);

endif;

endif;

endif;

OUTA <= conv_std_logic_vector(answer,8);

end process;

end Behavioral;

Das könnte Ihnen auch gefallen