From 79cc4a3cd4d01b3c553407917225eb14ff49a5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 19 Feb 2019 10:50:17 +0100 Subject: Tue, 19 Feb 2019 10:50:17 +0100 --- VHDL.wiki | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file 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); +}}} + -- cgit v1.2.3