Sprawozdanienaszuk LewkiewiczG2S1

Sprawozdanie z projektu laboratoryjnego w technologii CPLD
“Kalkulator”

Data wykonania projektu : 22.1.2014 Skład podgrupy: - Patryk Lewkiewicz

Data oddania projektu : 23.1.2014 - Bartosz Banaszuk

Prowadzący ćwiczenie : dr. inż Ryszard Szplet

Naszym zadaniem było zaprojektowanie prostego kalkulatora. Wprowadzanie liczb odbywało poprzez wciskanie odpowiednich przycisków na płytce testowe. Liczby były wprowadzane binarnie. Pierwsze trzy przyciski od lewej strony to pierwsza liczba, natomiast druga liczba były to kolejne 3 przyciski. Zmiana operacji dodawania lub odejmowania następowała po naciśnięciu ostatniego przycisku na płytce testowej.

Kod VHDL programu :

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.All;

use ieee.std_logic_unsigned.all;

entity kalkulator is

Port ( s1, s2, s3, s4, s5, s6, s7, s8, clk : in STD_LOGIC;

seg : inout STD_LOGIC_VECTOR (8 downto 0));

end kalkulator;

architecture Behavioral of kalkulator is

signal L1: std_logic_vector(3 downto 0):="0000";

signal L2: std_logic_vector(3 downto 0):="0000";

signal wynik: std_logic_vector(3 downto 0):="0000";

signal wynik1: std_logic_vector(3 downto 0):="0000";

begin

process(s1,s2,s3,clk)

begin

if rising_edge(clk) then

if s1='1' then L1<="0001"; end if;

if s2='1' then L1<="0010"; end if;

if s3='1' then L1<="0100"; end if;

if s1='1' and s2='1' then L1<="0011"; end if;

if s1='1' and s3='1' then L1<="0101"; end if;

if s2='1' and s3='1' then L1<="0110"; end if;

if s2='1' and s3='1' and s1='1' then L1<="0111"; end if;

if s1='0' and s2='0' and s3='0' then L1<="0000"; end if;

end if;

end process;

process(s4,s5,s6,clk)

begin

if rising_edge(clk) then

if s4='1' then L2<="0001"; end if;

if s5='1' then L2<="0010"; end if;

if s6='1' then L2<="0100"; end if;

if s4='1' and s5='1' then L2<="0011"; end if;

if s4='1' and s6='1' then L2<="0101"; end if;

if s4='1' and s7='1' then L2<="1001"; end if;

if s5='1' and s6='1' then L2<="0110"; end if;

if s5='1' and s6='1' and s4='1' then L2<="0111"; end if;

if s5='0' and s6='0' and s4='0' then L2<="0000"; end if;

end if;

end process;

process(s8,clk)

begin

if rising_edge(clk) then

if s8='1' then

wynik <= L1+L2;

else

if L1>L2 then

wynik <=L1-L2;

else

wynik <="0000";

end if;

end if;

end if;

end process;

process(seg,clk)

begin

if rising_edge(clk) then

wynik1<= wynik;

case wynik1 is

when "0000" => seg<="110000100";

when "0001" => seg<="111110101";

when "0010" => seg<="110100010";

when "0011" => seg<="111100000";

when "0100" => seg<="111010001";

when "0101" => seg<="111001000";

when "0110" => seg<="110001000";

when "0111" => seg<="111100101";

when "1000" => seg<="110000000";

when "1001" => seg<="111000000";

when "1010" => seg<="000000100";

when "1011" => seg<="001110101";

when "1100" => seg<="000100010";

when "1101" => seg<="001100000";

when "1110" => seg<="001010001";

when others => wynik1<=( others =>'0');

end case;

end if;

end process;

end Behavioral;


Wyszukiwarka

Podobne podstrony:
2 definicje i sprawozdawczośćid 19489 ppt
PROCES PLANOWANIA BADANIA SPRAWOZDAN FINANSOWYC H
W 11 Sprawozdania
Wymogi, cechy i zadania sprawozdawczośći finansowej
Analiza sprawozdan finansowych w BGZ SA
W3 Sprawozdawczosc
1 Sprawozdanie techniczne
Karta sprawozdania cw 10
eksploracja lab03, Lista sprawozdaniowych bazy danych
2 sprawozdanie szczawianyid 208 Nieznany (2)
Fragmenty przykładowych sprawozdań
Lab 6 PMI Hartownosc Sprawozdan Nieznany
Mikrokontrolery Grodzki Sprawoz Nieznany
biochemia sprawozdanie O (1)
Chemia fizyczna sprawozdanie (6 1) id 112219
201 sprawozdanie finansoweid 26953
Czarne orly sprawozdanie2

więcej podobnych podstron