====== Syntax ======
* HDL = Modelling language
* **VHDL** Very high speed integrated Hardware Description Language
* Auf Europäischem Markt verbreitet
* IEEE Standartisiert
* An Ada angelehnt
* Verilog
* Auf Amerikanischem Markt verbreitet
* Komplett case insensitive
* ''%%--%%'' ist Kommentar
* **RTL** Register-Transfer-Level (Logik, Register, Logik, Register, Logik, ...)
* Register = D-FF Array
* file = library = modul ... deren name wird vom compiler festgelegt => lib weis nicht wie sie heist => ''work'' verwenden
-- synthesis translate_off
-- synthesis translate_on
Das folgende ist mixbar
* architecture
* structural (Aufbau einer Modul Hierarchie; ''component'' verwenden)
* behavorial (Blätter der Hierarchie)
* dataflow (Nur zuweisungen)
* process (''process'' verwenden)
* combinatorial circuit
* Eigenschaft: state less
* Als
* dataflow
* process (keine clock, //Alle Inputs// in sensivity list, //Alle Outputs immer// zuweisen (ggf. default Werte))
* sequential circuit
* Eigenschaft: Stateful
* synchronous (clocked)
* edge-triggered (D-FF)
* level-sensitive (D-Latch) => //hazards// möglich
Mögliches Design: combinatorial circuit => Register (D-FF Array) => combinatorial circuit => Register (D-FF Array) => ...
==== Komponenten ====
* module/component/file
* ''library''/''use'' (is nach jedem entity wieder weg)
* ''entity'' (Schnitstelle)
* ''architecture'' (Implementierung der Schnitstelle (entity))
* optional: ''configuration'' (Auswahl wenn mehrere architectures eine entity beschreiben)
==== Datentypen ====
* ''bit''
* '0'
* '1'
* ''std_logic'' (in std_logic_1164)
* ''%%'%%U%%'%%'': //U//ninitialized
* ''%%'%%X%%'%%'': Unknown, conflict
* ''%%'%%0%%'%%'':
* ''%%'%%1%%'%%'':
* ''%%'%%Z%%'%%'': High Impedance
* ''%%'%%W%%'%%'': //W//eak unknown, conflict
* ''%%'%%L%%'%%'': Weak logic ''0''
* ''%%'%%H%%'%%'': Weak logic ''1''
* ''%%'%%-%%'%%'': Don't care
* ''type is array(0 to 7) of std_vector;''
==== Values ====
=== Signale ===
signal a : std_logic;
signal b : std_logic := '0';
signal c : std_logic_vector(0 to 7);
signal d : std_logic_vector(7 downto 0) := "10101100";
=== Konstanten ===
constant A : integer := 42;
constant B : real := 4.2;
=== Variablen ===
variable a : integer;
variable b : integer := 42;
variable c, d : integer;
b := 1337;
Deklaration in
* Prozessen (architecture body)
* Shared
=== Unconditional signal assignment ===
a <= b;
a <= '0';
c <= "11110101";
===== Library Units =====
==== library ====
library ;
library ieee;
library lib
entity ...
end;
-- lib is now unknown
* Nur eine ebene
==== use ====
use .[.|.all];
use work.[.|.all];
library lib
use lib.pack;
... pack.decl
library lib
use lib.pack.decl;
... decl
library lib
use lib.pack.all;
... decl
http://www.sigasi.com/content/work-not-vhdl-library
==== Entity ====
**Schnittstelle**
entity is
[generic(...);]
port(...);
end ;
Generic = Parametriesierbare Schnittstelle
Wird das Modul (beschrieben durch die entity) instanziiert, wirken die //konstanten// ''generic'' Parameter wie Funktions Parameter. Z.B. breiter eines Addierers.
Ein Port kann sein
* ''in''
* ''out''
* ''inout''
entity EntityFoo is
port(
a: in std_logic;
b: out std_logic;
);
end EntityFoo;
[ :] assert
[report "..."]
[servity note|warning|eror|failure]
;
entity EntityFoo is
port(
a: in std_logic;
b: out std_logic;
);
begin
-- synthesis translate_off
check1 : assert a = '1'
report "Nope! Nope! Nope!";
-- synthesis translate_on
end EntityFoo;
==== Architecture ====
**Verhalten**
architecture of is
begin
end ;
architecture ArchitectureBar of EntityFoo is
begin
b <= a;
end ArchitectureBar;
Von ''out'' Signalen kann nicht gelesen werden => Hilfssignale
Eine Entity hat mehrere Architectures.
==== Component declaration ====
Definiert wie die Entity jetzt verwendet werden soll: Reihenfolge der Ports/Generics für die Port/Generic maps. Die Reihung muss vollständig sein.
component
[generic(...);]
port(...);
end component;
architecture structure of latch is
component nor_gate
port(
a: in bit;
b: in bit;
c: out bit
);
end component;
begin
n1: nor_gate
port map(r, nq, q);
n2: nor_gate
port map(s, q, nq);
end structure;
===== Parallel Statements =====
==== Process ====
[ :] process[(
begin
end process [];
Zugriff auf gesetzte Werte
* Variablen: Sofort
* Signale: Am Ende ober beim nächsten ''wait''
Prozess //muss eines// von beiden verwenden (XOR)
* ''wait''
* sensitivity list
Ohne eins er follgenden geht ein Prozess in Dauerschleife:
* ''wait;''
* sensitivity list
... ''wait for 10 ns'' ist OK
Erlaubt
* case
* if
* for
* while
* unconditional assignment
Nicht erlaubt
* conditional assignment
* selected assignment
=== Synchronisation ===
if clock'event and clock = '1' then ....
if rising_edge(clock) then ...
if falling_edge(clock) then ...
Synchronisation ohne Reset (sensitivity list: clock)
if rising_edge(clock) then
...
end if;
Synchronisation mit asynchronem Reset (sensitivity list: reset & clock)
if reset='1' then
...
elseif rising_edge(clock) then
...
end if;
Synchronisation mit synchronem Reset (sensitivity list: clock)
if rising_edge(clock) then
if reset = '1' then
...
else
...
end if;
end if;
==== Component instantiation ====
Erzeuge eine Instanz der Entität mit konkreten Ports/Generic Parametern.
:
[generic map(...)]
port map(...);
Achtung: //kein// '';'' zwischen drinn.
generic map(1, 2, 3)
generic map(a => 1, b => 2, c=> 3)
port map(1, 2, 3)
port map(a => sig1, b => sig2, c=> sig3)
architecture structure of latch is
component nor_gate
port(
a: in bit;
b: in bit;
c: out bit
);
end component;
begin
n1: nor_gate
port map(r, nq, q);
n2: nor_gate
port map(s, q, nq);
end structure;
==== Bedingte Zuweisung ====
Conditional Signal Assignment \\ Reihenfolge wichtig
bar:
a <=
x when b = '0' else
y when b = '1' else
z;
* Kein trenner (auser ''else'')
==== Auswahl Zuweisung ====
Selected Signal Assignment
bar: with b select
a <= x when '0',
y when '1',
z when others;
vectorName()
* '','' als Trenner
===== Sequential Statements =====
==== Bedingte Zuweisung ====
if b = '0' then
a <= x;
elsif b = '1' then
a <= y;
else
a <= z;
end if;
* '';'' als Trenner
* ''elsif'' //ohne **e**//
==== Auswahl Zuweisung ====
case b is
wehen '0' => a <= x;
wehen '1' => a <= y;
wehen others => a <= z;
end case;
* '';'' als Trenner