MY VHDL Programs
MY VHDL Programs
entity dec is
en : in STD_LOGIC);
end dec;
begin
process (en,i)
begin
if ( i = "00" ) then
o <= "0001";
o <= "0010";
o <= "0100";
end if;
end if;
end process;
end Behavioral;
4 to 1 MUX
entity mux4to1 is
f : out std_logic ) ;
end mux4to1 ;
Begin
Process(s,w0,w1,w2,w3)
begin
case s is
End case;
End process;
end behavior ;
PARALLEL ADDER
Entity parallel_adder is
End parallel_adder ;
Begin
Process(a,b,cin)
Variable c : std_logic;
Begin
C := cin;
For i in 0 to 3 loop
End loop;
O(4) <= c;
End process;
end behavior ;
SR LATCH
entity srlatch is
end srlatch;
begin
process (s,r)
begin
q <= s1;
entity jk1 is
end jk1;
begin
process (j,k,clk)
begin
s1 := '0';
r1 := '1';
q <= s1;
else
q <= q;
end if;
end process;
SISO REGISTER
Entity siso is
End siso;
begin
Process(din,clk,clr,q1)
Begin
q <= '0';
q1 <= "0000";
For I in 0 to 2 loop
End loop;
q <= q1(3);
Else q <= q;
End if;
End process;
End behav;
SIPO REGISTER
entity sipo is
port(
Input_Data: in std_logic;
end sipo;
begin
process (clk)
begin
Q <= "0000";
end if;
end process;
end arch;
PISO REGISTER
Entity piso is
End piso;
begin
Process(clk,clr,q1,pin,en)
Begin
q <= '0';
q1 <= "0000";
End if;
End loop ;
q <= q1(0);
Else q <= q;
End if;
End process;
End behav;
UP-DOWN COUNTER
entity updown_count is
end updown_count;
begin
process(clk,rst)
begin
if(rst='1')then
temp<="0000";
elsif(rising_edge(clk))then
if(updown='0')then
temp<=temp+1;
else temp<=temp-1;
end if;
end if;
end process;
count<=temp;
end Behavioral;
MOD-10 COUNTER
entity mod10_counter is
port(
clk : in STD_LOGIC;
reset : in STD_LOGIC;
);
end mod10_counter;
begin
if (reset='1') then
m := 0;
m := m + 1;
end if;
if (m=10) then
m := 0;
end if;
end behav;