Dinda Halla

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 25 October 2010

Multiplexer VHDL template

Posted on 00:47 by Unknown
Multiplexer berfungsi untuk memilih output dari beberapa input berdasarkan input pada kaki selectornya. Multiplexer memiliki rangkaian logika sebagai berikut :



Dalam tulisan kali ini akan dicontohkan kode program vhdl untuk membuat multiplexer dengan 4 input, 2 selector, dan 1 output. Multiplexer diatas memiliki tabel logika :

==========
= s1 = s2 = Y =
==========
= 0 = 0 = a =
= 0 = 1 = b =
= 1 = 0 = c =
= 1 = 1 = d =
===========


Pertama-tama definisikan entitas multiplexer dengan nama "kepletex" :

entity kepletex is -- mendefinisikan entity "kepletex"
port(
a,b,c,d,s1,s2: in bit; -- terdapat 4 port input, 2 selector, dan 1 output
y:out bit);
end kepletex;


Lalu definisikan arsitektur "mux_arch" dari entity "kepletex" :

architecture mux_arch of kepletex is
begin
proc: process is
begin
if (s1='0' and s2='0') then y <= a;
else if (s1='0' and s2='1') then y <= b;
else if (s1='1' and s2='0') then y <= c;
else if (s1='1' and s2='1') then y <= d;
end if;
end process proc;
end mux_arch;


Arsitektur berfungsi untuk menerangkan bagaimana entity "kepletex" bekerja. Namun kode diatas hanyalah berupa template, sehingga tidak bisa dijalankan untuk simulasi maupun di sintesis karena belum didefinisikan bit input pada masing-masing portnya. Untuk itu kita tambahkan entity "sinyal" dan arsitektur "sinyal_arch" yang berfungsi untuk memberikan input pada entity "kepletex".

entity sinyal is
port(
pa,pb,pc,pd,ps1,ps2:out bit);
end sinyal;

architecture sinyal_arch of sinyal is
begin
pros: process is
begin
pa <= '0';
pb <= '1';
pc <='1';
pd <= '0';
ps1 <= '1';
ps2 <= '0';
end process pros;
end sinyal_arch;


Semua kode vhdl diatas digabung menjadi satu menjadi :

library ieee;
use ieee.std_logic_1164.all;

entity kepletex is -- mendefinisikan entity "kepletex"
port(
a,b,c,d,s1,s2: in bit; -- terdapat 4 port input, 2 selector, dan 1 output
y:out bit);
end kepletex;

architecture mux_arch of kepletex is
begin
proc: process is
begin
if (s1='0' and s2='0') then y <= a;
else if (s1='0' and s2='1') then y <= b;
else if (s1='1' and s2='0') then y <= c;
else if (s1='1' and s2='1') then y <= d;
end if;
end process proc;
end mux_arch;

entity sinyal is
port(
pa,pb,pc,pd,ps1,ps2:out bit);
end sinyal;

architecture sinyal_arch of sinyal is
begin
pros: process is
begin
pa <= '0';
pb <= '1';
pc <='1';
pd <= '0';
ps1 <= '1';
ps2 <= '0';
end process pros;
end sinyal_arch;

-- kode dibawah ini merupakan kode yang berfungsi menjalankan --
-- entity yang telah didefinisikan diatas --

library work;
use work.all;

entity eksekusi is
end eksekusi;

architecture eksekusi_arch of eksekusi is
signal in1,in2,in3,in4,select1,select2,output: bit;
begin
w1: entity sinyal port map(in1,in2,in3,in4,select1,select2);
w2: entity kepletex port map(in1,in2,in3,in4,select1,select2,output);
end eksekusi_arch;Multiplexer VHDL template

by : dinda
Read More
Posted in | No comments

LIBRARY VHDL

Posted on 00:44 by Unknown
Dalam bahasa pemrograman vhdl dikenal pula paket library/pustaka yang berfungsi untuk memudahkan prorammer untuk menyelesaikan pekerjaannya karena dalam library tersebut terdapat fungsi-fungsi dan tipe data yang sudah didefinisikan sebelumnya untuk digunakan berulang-ulang. Dalam vhdl terdiri beberapa library, diantaranya ieee, std, work dan lain-lain. Di dalam library tersebut terdapat sub-tree yang disebut sebagai paket, diantaranya :

LIBRARY IEEE :
- math_real
- numeric_bit
- numeric_std
- std_logic_1164
- std_logic_arith
- std_logic_signed
- std_logic_unsigned
- vital_timing

LIBRARY STD :
- standard
- textio

LIBRARY WORK :
semua source code user akan dicompile dan dimasukkan ke dalam library ini

by : dinda
Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • tulisan 8 bahasa inggris bisnis 2
    our mother is sacred .. prayer can be granted, and the curse may be true therefore we are never a waste of capital without the empty crate ...
  • User Interface Management System (UIMS)
    User Interface Management System (UIMS) adalah sebuah mekanisme untuk proses memisahkan bersih atau logika bisnis dari antarmuka pengguna g...
  • tugas bahasa inggris bisnis 2
    1.    Theory and example of active-passive sentences      Active Sentences An active sentence is the opposite of a passive sentence.  In an ...
  • For My Husband
    Dear.. Without You I'm anxious away from you I can not I was nervous thinking about you I could not part from you ... Love ...
  • macam-macam solusi stres
    Lagi stres nih! Tenang, Kita tidak sendiri, setiap orang pernah mengalaminya kok. Bahkan stres diperlukan agar seseorang termotivasi untuk...
  • tulisan 9 bahasa indonesia 2
    cara membuat tumis anak hiu alias ikan teri,,hehe 1.goreng ikan teri setengah matang 2. tumis bawang merAH dan bawang utih hingga harum 3. m...
  • tulisan 6 bahasa indonesia 2
    MU VS CHELSEA wow seru banget nonton bola MU vs chelsea baru beberapa menit aja udah gol 2-0 untuk MU. memang bener-bener hebat deh MU . her...
  • Hantu wanita tanpa kepala
    Saya seorang yg bisa dibilang udah biasa dengan hal2 aneh, penampakan, atau semacam itu. Beruntung atau nda, dari kecil Saya dpt berkah tuk...
  • Perawatan Terbaik Bagi Kulit Kering
    1. Jangan mandi terlalu lama, apalagi menggunakan shower (pancuran). 2. Jika harus men...
  • tugas bahasa indonesia 3
    metode sebab-akibat Pada saat ini masih banyak orang yang tidak menyadari pentingnya fungsi pohon bagi kelangsungan hidup manusia...

Blog Archive

  • ►  2012 (11)
    • ►  May (9)
    • ►  March (2)
  • ►  2011 (21)
    • ►  December (5)
    • ►  October (1)
    • ►  May (11)
    • ►  April (1)
    • ►  March (1)
    • ►  February (2)
  • ▼  2010 (101)
    • ►  December (13)
    • ▼  October (2)
      • Multiplexer VHDL template
      • LIBRARY VHDL
    • ►  June (59)
    • ►  May (20)
    • ►  April (4)
    • ►  March (3)
  • ►  2008 (1)
    • ►  November (1)
Powered by Blogger.

About Me

Unknown
View my complete profile