aboutsummaryrefslogtreecommitdiff
path: root/VHDL.wiki
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-19 10:50:17 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-19 10:50:17 +0100
commit79cc4a3cd4d01b3c553407917225eb14ff49a5f6 (patch)
tree3828f17437e71fc9fb2d054eae576d4944671a12 /VHDL.wiki
parentTue, 19 Feb 2019 10:43:22 +0100 (diff)
downloadwiki-public-79cc4a3cd4d01b3c553407917225eb14ff49a5f6.tar.gz
wiki-public-79cc4a3cd4d01b3c553407917225eb14ff49a5f6.tar.xz
Tue, 19 Feb 2019 10:50:17 +0100
Diffstat (limited to 'VHDL.wiki')
-rw-r--r--VHDL.wiki56
1 files changed, 52 insertions, 4 deletions
diff --git a/VHDL.wiki b/VHDL.wiki
index dff44f4..b9f29f2 100644
--- a/VHDL.wiki
+++ b/VHDL.wiki
@@ -1,3 +1,11 @@
+= Contents =
+ - [[#VHDL|VHDL]]
+ - [[#VHDL#"Kod"|"Kod"]]
+ - [[#VHDL#Exempelkrets|Exempelkrets]]
+ - [[#VHDL#Datatytper|Datatytper]]
+ - [[#VHDL#Datatytper#std_logic|std_logic]]
+ - [[#VHDL#Datatytper#std_logic_vector|std_logic_vector]]
+
= VHDL =
VHDL = VHSIC HDL
@@ -29,14 +37,18 @@ end architecture namn2;
== Exempelkrets ==
+Uttrycket
+
{{$
\begin{aligned}
-\text{låt} x &= a \wedge b \\
- y &= a \vee b :
+\text{låt } x &= a \wedge b \\
+ y &= a \vee b \\
+\text{i } c &= \neg (x \vee y)
\end{aligned}
-c = \neg (x \vee y)
}}$
+kan i VHDL realiseras som:
+
{{{vhdl
entity knet is
port (a, b : in std_logic;
@@ -51,7 +63,43 @@ begin
y <= a or b;
end architecture fisttry;
}}}
+.
+== Datatytper ==
Mycket hårt typat, men nästan inga datatyper. Så nästintill allting
-måste deffinieras upp själv.
+måste deffinieras upp själv. Standardbibliotek lägger dock till
+allting man behöver.
+
+Konstiga fulhak undanbedes.
+
+Standardbiblioteket importeras enkalst genom
+{{{VHDL
+library ieee; -- Berätta att biblioteket finns.
+use ieee.standard_logic_1164.all; -- Importera det vi vill ha (allt)
+}}}
+
+=== std_logic ===
+"bit" typ (Namnet bit var tydligen redan upptaget).
+
+Kan ha värdena `01uxz-wlh`.
+
+- `U` Uninitialized
+- `X` Forceing unkwon (i simulering när flera utgångar försöker driva signalen)
+- `0` tvingad låg
+- `1` tvingad hög
+- `Z` High impedance (högohmig) (Tri state, stäng av komponenent)
+- `-` Don't care
+
+=== std_logic_vector ===
+Vektor av bitar.
+
+Storlek skrivs antingen med `to` eller `downto`. Notera att de är
+sepparat implementerade, och man ska hålla sig till den ena om man
+inte vet vad man gör.
+
+{{{VHDL
+std_logic_vector (0 to 2);
+std_logic_vector (5 downto 2);
+}}}
+