Senin, 25 Oktober 2010

Tugas FPGA : Standart Library IEEE, STD dan Work

1. Library IEEE:
use IEEE.std_logic_1164.all;
use IEEE.std_logic_textio.all;
use IEEE.std_logic_arith.all;
use IEEE.numeric_bit.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_signed.all;
use IEEE.std_logic_unsigned.all;
use IEEE.math_real.all;
use IEEE.math_complex.all;


2. Library STD :
use STD.standard.all;
use STD.textio.all;


3. Library WORK :
Sebuah pendeklarasian yang implisit,dimana semua source codenya akan dimasukkan ke library tersebut.
Contoh :
use WORK.data_types.all;
dll.


referensi : http://www.cs.umbc.edu/portal/help/VHDL/stdpkg.html

Tugas FPGA : Contoh Pemograman VHDL Pada D Flip Flop


Salah satu contoh program VHDL dari sebuah D Flip-Flop edge triggered positif dengan asynchronous Reset adalah sebagai berikut:

library ieee;
use ieee.std_logic_1164.all;
entity DFF_RST is
port (CLK, RESET, D : in std_logic;
Q : out std_logic);
end DFF_RST;


architecture BEHAV_DFF of DFF_RST is
begin
DFF_PROCESS: process (CLK, RESET)
begin
if (RESET = ‘1’) then
Q <= ‘0’;
elsif (CLK’event and CLK = ‘1’) then
Q <= D;
end if;
end process;
end BEHAV_DFF;


Sumber:
http://www.seas.upenn.edu/~ese201/vhdl/vhdl_primer.html#DFlipFlop