diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 10:50:17 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-19 10:50:17 +0100 |
commit | 79cc4a3cd4d01b3c553407917225eb14ff49a5f6 (patch) | |
tree | 3828f17437e71fc9fb2d054eae576d4944671a12 /VHDL.wiki | |
parent | Tue, 19 Feb 2019 10:43:22 +0100 (diff) | |
download | wiki-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.wiki | 56 |
1 files changed, 52 insertions, 4 deletions
@@ -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); +}}} + |