Anda di halaman 1dari 10

And

Structural behaviour

Hubungan antara design entity , entity


declaration, dan architecture body

Menggambarkan input dan output dari


rancangan (entity).
The I/O of the chip.
Koneksi dalam desain rangkaian.
entity add4 is port(
a,b : in std_logic_vector(3 downto 0);
ci
: in std_logic;
sum : out std_logic_vector(3 downto 0);
co : out std_logic);
end add4;

Setiap signal I/O di entity disebut port.


Analogi di IC disebut pin
Port adalah sebuah objek data. Dapat di
tentukan nilainya atau tergantung kondisi.
Satu set port disebut port declaration.
Tiap port harus diberi nama (a,b, dll), direction
mode (in, out, inout, buffer), dan type data.
Penamaan port tidak boleh diawali angka, _ , _
_, #, reserved word,

1)

2)

3)

Menggambarkan arah data di transfer melalui


port. Jika tidak didefinisikan default sbg in.
In : arus data hanya menuju chip entity.
Penggeraknya dari luar. Contoh : clock input,
input kontrol ( reset, load, enable dll) , data
Out : arus data hanya keluar entity.
Penggeraknya dari dalam entity.
Buffer : sama dengan out tetapi data bisa
dibaca sebagai feedback in. contoh pada
counter.

4) Inout : bidirectional signal. Arah arus data


masuk dan keluar pada port yang sama.
Penggerak signal dari luar dan dalam. Dapat
menggantikan semua mode port : in, out,
buffer. Contoh pada ram

Boolean : values TRUE or FALSE


Bit : 0 dan 1
Bit_vector : array of 0 dan 1.
Integer : bilangan bulat 0,1,2 dst bukan 2,5 dll
Untuk sintesis , simulasi dan dikenal oleh library
IEEE std_logic_1164 menggunakan :
Std_ulogic
Std_logic
Array

Values are :
U , --- Uninitialized
X , --- Forcing Unknow
0 , --- Forcing 0
1 , --- Forcing 1
Z , --- High Impedance
W , --- Weak unknow
- , --- Dont care

Like a black box by an engineer


Menggambarkan fungsi entity
Behavioral description : tergantung gaya
bahasa coding individu; contoh eqcomp4 dapat
di coding dengan beberapa coding.

architecture dataflow of eqcomp4 is


begin
equals <= 1 when (a=b) else 0;
end dataflow;

architecture behavioral of eqcomp4 is


begin
comp : process (a, b)
begin
if a = b then
equals <= 1;
else
equals <= 0;
end if;
end process comp;
end behavioral;

architecture behavioral of eqcomp4 is


begin
comp : process (a, b)
begin
equals <= 0;
if a = b then
equals <= 1;
end if;
end process comp;
end behavioral;

library ieee;
use ieee.std_logic_1164.all;
Entity eqcomp4 is port(
a,b : in std_logic_vector(3 downto 0);
equals : out std_logic);
End eqcomp4;
Architecture bool of eqcomp4 is
Begin
equals <=
not(a(0) xor b(0))
and not (a(1) xor b(1))
and not (a(2) xor b(2))
and not (a(3) xor b(3));
End bool;

a b ab

Not (ab)

0 0

0 1

1 0

1 1

Anda mungkin juga menyukai