Skip to content

Commit 3948cc9

Browse files
committed
Report for digital circuits class (combination lock in VHDL)
1 parent a1107d2 commit 3948cc9

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed

UCiSW/Lab5/fst.png

9.97 KB
Loading

UCiSW/Lab5/main.tex

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
\documentclass[12pt,a4paper,titlepage]{article}
2+
\usepackage[utf8]{inputenc}
3+
\usepackage{polski}
4+
\usepackage{listings}
5+
\usepackage{graphicx}
6+
\usepackage{xcolor}
7+
\usepackage{minted}
8+
\makeatletter
9+
\newcommand{\linia}{\rule{\linewidth}{0.4mm}}
10+
\renewcommand{\maketitle}{\begin{titlepage}
11+
\vspace*{1cm}
12+
\begin{center}\small
13+
Politechnika Wrocławska\\
14+
Wydział Elektroniki\\
15+
Urządzenia cyfrowe i systemy wbudowane 1
16+
\end{center}
17+
\vspace{3cm}
18+
\noindent\linia
19+
\begin{center}
20+
\LARGE \textsc{\@title}
21+
\end{center}
22+
\linia
23+
\vspace{0.5cm}
24+
\begin{flushright}
25+
\begin{minipage}{7cm}
26+
\textit{\small Autor:}\\
27+
\normalsize \textsc{\@author} \par
28+
\end{minipage}
29+
\vspace{5cm}
30+
31+
{\small Wtorek, 7\textsuperscript{30}-10\textsuperscript{15} TP}\\
32+
Dr inż. Dariusz Caban
33+
\end{flushright}
34+
\vspace*{\stretch{6}}
35+
\begin{center}
36+
22 stycznia 2019
37+
% \@date
38+
\end{center}
39+
\end{titlepage}%
40+
}
41+
\makeatother
42+
\author{Justyna Skalska, 225942\\
43+
Piotr Pawelski, 218370}
44+
\title{Sprawozdanie nr 4\\
45+
\large(Zamek szyfrowy w VHDL)}
46+
47+
\begin{document}
48+
\maketitle
49+
50+
\section{Wstęp}
51+
Celem laboratorium było zaprojektowanie automatu otwierającego zamek szyfrowy w języku VHDL. Hasło składało się z 2 cyfr: 122. Przyciski znajdujące się na płytce odpowiadały poszczególnym cyfrom od 1 do 8. Zaświecenie się wszystkich diód oznaczało poprawne otwarcie zamka szyfrowego.\\\\
52+
Programem wykorzystanym do wykonania zadania jest ISE Design Suite.
53+
54+
\section{Przebieg zajęć}
55+
Zajęcia rozpoczęliśmy zaprojektowania stanów automatu oraz przejść pomiędzy nimi. Następnie zaprogramowaliśmy je w języku VHDL wraz z odpowiednimi wejściami i wyjściami.
56+
57+
58+
59+
\begin{listing}[H]
60+
\caption{Kod VHDL}
61+
\begin{minted}[linenos,breaklines]{vhdl}
62+
63+
library IEEE;
64+
use IEEE.STD_LOGIC_1164.ALL;
65+
66+
67+
entity FST is
68+
Port ( Key : in STD_LOGIC_VECTOR (0 to 7);
69+
Clk : in STD_LOGIC;
70+
Output : out STD_LOGIC_VECTOR (0 to 7));
71+
end FST;
72+
73+
architecture Behavioral of FST is
74+
75+
type state_type is ( A, A1, B, B1, C, C1, D );
76+
signal state, next_state : state_type;
77+
begin
78+
79+
process1 : process( Clk )
80+
begin
81+
if rising_edge( Clk ) then
82+
83+
state <= next_state;
84+
85+
end if;
86+
87+
end process process1;
88+
89+
process2 : process( state, Key )
90+
begin
91+
next_state <= state; -- by default
92+
93+
case state is
94+
95+
when A =>
96+
if Key = "00000001" then
97+
next_state <= A1;
98+
end if;
99+
\end{minted}
100+
\end{listing}
101+
\newpage
102+
\begin{listing}[H]
103+
\caption{Kod VHDL}
104+
\begin{minted}[linenos,breaklines]{vhdl}
105+
when A1 =>
106+
if Key = "00000000" then
107+
next_state <= B;
108+
end if;
109+
110+
when B =>
111+
if Key = "00000010" then
112+
next_state <= B1;
113+
elsif Key = "00000000" then
114+
next_state <= B;
115+
else
116+
next_state <= A;
117+
end if;
118+
119+
when B1 =>
120+
if Key = "00000000" then
121+
next_state <= C;
122+
end if;
123+
124+
when C =>
125+
if Key = "00000010" then
126+
next_state <= C1;
127+
elsif Key = "00000000" then
128+
next_state <= C;
129+
else
130+
next_state <= A;
131+
end if;
132+
133+
when C1 =>
134+
if Key = "00000000" then
135+
next_state <= D;
136+
end if;
137+
\end{minted}
138+
\end{listing}
139+
\newpage
140+
\begin{listing}[H]
141+
\caption{Kod VHDL}
142+
\begin{minted}[linenos,breaklines]{vhdl}
143+
when D =>
144+
if Key = "00000001" then
145+
next_state <= A1;
146+
elsif Key = "00000000" then
147+
next_state <= D;
148+
else
149+
next_state <= A;
150+
end if;
151+
152+
end case;
153+
154+
end process process2;
155+
156+
process3 : process( state )
157+
begin
158+
159+
160+
case state is
161+
162+
when A =>
163+
Output <= "11111110";
164+
165+
when A1 =>
166+
Output <= "11111101";
167+
168+
when B =>
169+
Output <= "11111011";
170+
171+
when B1 =>
172+
Output <= "11110111";
173+
174+
when C =>
175+
Output <= "11101111";
176+
\end{minted}
177+
\end{listing}
178+
\newpage
179+
\begin{listing}[H]
180+
\caption{Kod VHDL}
181+
\begin{minted}[linenos,breaklines]{vhdl}
182+
when C1 =>
183+
Output <= "11011111";
184+
185+
when D =>
186+
Output <= "00000000";
187+
188+
end case;
189+
190+
end process process3;
191+
192+
193+
end Behavioral;
194+
195+
196+
\end{minted}
197+
\end{listing}
198+
199+
Kolejnym etapem było wygenerowanie symbolu naszej maszyny stanów oraz stworzenie prostego schematu na którym dołączyliśmy do niej wejścia i wyjścia.
200+
201+
\begin{figure}[H]
202+
\centering
203+
\includegraphics[angle=90,height=20cm]{fst.png}
204+
\caption{Schemat układu}
205+
\label{fig:schemat}
206+
\end{figure}
207+
208+
209+
210+
\begin{itemize}
211+
\item \textbf{Keys(0:7)} to kolejne przyciski odpowiadające cyfrom od 1 do 8
212+
\item \textbf{Clk\_LF} to wejście układu odpowiadające za dostarczenie sygnału zegara.
213+
\item \textbf{LED(0:7)} to diody, które pokazują w jakim stanie znajduje się obecnie układ oraz czy zamek został otwarty
214+
\end{itemize}
215+
Następnym zadaniem, które wykonaliśmy było skompilowanie układu oraz wygenerowanie pliku .jed, który jest używany do programowania mikroprocesorów. Następnie przesłaliśmy nasz program na płytkę, gdzie udało nam się poprawnie wpisać szyfr oraz otworzyć zamek.
216+
217+
\section{Wnioski}
218+
Podczas laboratoriów mogliśmy zapoznać się z podstawami tworzenia automatów w języku VHDL przy użyciu programu ISE Design Suite.
219+
\end{document}

UCiSW/Lab5/schemat.png

43.1 KB
Loading

0 commit comments

Comments
 (0)