2. STUDI PUSTAKA
Pada praktikum kali ini praktikan akan mencoba
merancangan rangkaian sekuensial. Perbedaan
mendasar rangkaian kombinasional dengan
rangkaian sekuensial adalah ada tidaknya memory
statenya. Keluaran rangkaian sekuensial
bergantung pada statw dan bergantung pada
masukannya (rangkaian Mealy) atau hanya
bergantung pada statenya (rangkaian Moore).
Terdapat perbedaan beberapa model yang
digunakan untuk membantu erancang rangkaian
sekuensial. Salah satunya yang paling banyak
digunakan adalah Finite State Machine (FSM).
Dinamakan FSM karena jumlah state yang
mungkin terbatas dan rangkaian sekuensial bekerja
Laporan Praktikum - Laboratorium Dasar Teknik Elektro – STEI ITB 1
b. Percobaan 4B
3. METODOLOGI
Implementasikan desain tersebut
Pada saat percobaan, praktikan menggunakan alat pada FPGA dengan pin planner yang
sudah diunduh (deklarasi pin dapat
dan komponen sebagai berikut: dilihat di file "qsf").
1. Komputer/PC yang telah terinstal
program Quartus II 9.0
2. Monitor LCD
3. FPGA development board, tipe ALTERA Lakukan beberapa perubahan posisi
DE1 beserta perlengkapannya yang wsitch pada board FPGA untuk
meliputi: melihat efek dan perubahannya
pada layar LCD! pelajari input dan
keluaran dari desain tersebut untuk
a. Board FPGA tipe DE1 selanjutnya digabungkan dengan
modul FSM yang telah dibuat.
b. Catu daya + kabel dan konektor
tambahan
Gambar 3-2 Diagram alur percobaan 4B
c. Kabel USB‐Blaster
c. Percobaan 4C
Percobaan-percobaan pada modul ini dilakukan
sebagai berikut:
Hubungkan keluaran FSM dengan
a. Percobaan 4A masukan modul VGA. Lakukan
compile dan download gabungan
desain FSM dan modul VGA ke
Buat folder sebagai direktori dalam board FPGA. Amati hasil
kerja baru untuk praktikum yang didapat.
modul ini lalu copy script
yang sudah dikerjakan saat
TP ke dalam folder tersebut. Gambar 3-3 Diagram alur percobaan 4C
Lakukan kompilasi Analysis & Lakukan kompilasi secara Gambar 4-2 Waveform Percobaan 4A
Synthesis menyeluruh
US BT
Mode H_US = 0
Gambar 4-1 Gambar FSM Rambu Lalu Lintas malam:
M_BT = 0
t<8
Selain itu, praktikan juga sudah
melakukan pencarian waveform dengan Mode
pendekatan VHDL. Dalam kasus lampu siang:
lalu lintas, praktikan menggunakan 3 blok t<4
yaitu FSM, Clockdiv, dan trafficlight
sebagai top level. Bahasa VHDL untuk Mode K_US = 0
percobaan 4A, 4B, dan 4C akan malam:
ditampilkan pada lampiran. Dari M_BT = 0
percobaan yang sudah dilakukan, t<1
darurat
K_BT = 0
menyala
( t = 4) Gambar 4-4 Blok diagram sederhana terkait hubungan
FPGA, VGA, dan monitor
Mode Semua
darurat lampu mati Berdasarkan blok diagram yang telah ditunjukkan
Kembali (= 1) pada gambar 4-4, berikut merupakan beberapa
ke awal hasil percobaan 4B.
US BT
Mode H_US = 0
malam:
M_BT = 0
t<8
Mode
siang:
t<4
Gambar 4-11 Gambar SW1[0], SW1[1], SW1[2] = 1
Mode K_US = 0
malam:
M_BT = 0
t<1
Mode
siang:
t<2
Mode M_US = 0
malam:
H_BT = 0
t<8
Mode
siang:
Gambar 4-12 Gambar SW1[3], SW1[4], SW1[5] = 1 t<4
5. KESIMPULAN
Dari percobaan yang telah dilakukan, praktikan
dapat membuat kesimpulan sebagai berikut.
1. Rangkaian logika sekuensial adalah
rangkaian yang bergantung pada state
sebelumnya sehingga terdapat memori
yang menyimpan output sementara untuk
dijadikan input (looping).
2. Rangkaian logika sekuensial dapat
diimplementasikan ke dalam FPGA seperti
simulasi lampu lalu lintas dan kalkulator
Gambar 4-14 FSM Kalkulator FPB spesifik.
3. FSM (Finite State Machine) merupakan
salah satu model hierarki dalam rangkaian
DAFTAR PUSTAKA
[1] Alexander, Charles K, dan Sadiku, Matthew
N.O,Fundamental of Electric Circuit Fifth Edition,
2013
[2] http://esd.cs.ucr.edu/, 10 November 2022,
02.51
[3] Hutabarat, Mervin T, dkk, Petunjuk Praktikum
RangkaiaN Elektrik, 2022
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity trafficlight is
mode_darurat : in std_logic;
mode_siang : in std_logic;
end trafficlight;
component CLOCKDIV is
end component;
component FSM is
port (
counter_clk : in std_logic;
mode_darurat : in std_logic;
mode_siang : in std_logic;
end component;
end structural;
Clockdiv.vhd
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity CLOCKDIV is
port(
CLK : IN std_logic;
DIVOUT : buffer BIT);
end CLOCKDIV;
architecture behavioural of CLOCKDIV is
begin
PROCESS(CLK)
variable count: integer:=0;
constant div: integer:=50000000;
begin
if (CLK'event) and (CLK='1') then
if(count<div) then
count:=count+1;
if(DIVOUT='0') then
DIVOUT<='0';
elsif(DIVOUT='1') then
DIVOUT<='1';
end if;
else
if(DIVOUT='0') then
DIVOUT<='1';
elsif(DIVOUT='1') then
DIVOUT<='0';
end if;
count:=0;
end if;
end if;
end process;
end behavioural;
Fsm.vhd
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity FSM is
port (
counter_clk : in std_logic;
mode_darurat : in std_logic;
end FSM;
begin
begin
end if;
else
count <= 0;
end if;
then
case currentstate is
when s0 =>
else
count <= 0;
end if;
when s1 =>
else
count <= 0;
end if;
when s2 =>
else
count <= 0;
end if;
when s3 =>
if (count < 2) then
currentstate <= s3;
count <= count + 1;
else
currentstate <= s0;
count <= 0;
end if;
when others =>
currentstate <= s0;
end case;
elsif ((counter_clk'event and counter_clk = '1') and (mode_siang = '0'))
then
case currentstate is
when s0 =>
if (count < 4) then
currentstate <= s0;
count <= count + 1;
else
currentstate <= s1;
count <= 0;
end if;
when s1 =>
if (count < 1) then
currentstate <= s1;
count <= count + 1;
else
currentstate <= s2;
count <= 0;
end if;
when s2 =>
if (count < 4) then
currentstate <= s2;
count <= count + 1;
else
currentstate <= s3;
count <= 0;
end if;
when s3 =>
else
count <= 0;
end if;
end case;
end if;
end process;
Output : process(currentstate)
Begin
case currentstate is
end case;
end process;
2. Source code percobaan 4D
Blok klakulator.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
use work.all;
entity kalkulator is
);
end kalkulator;
component fsm is
);
end component;
component mux is
);
end component;
component comparator is
x, y: in std_logic_vector( 3 downto 0 );
);
end component;
component subtractor is
x, y: in std_logic_vector( 3 downto 0 );
);
end component;
component regis is
);
end component;
downto 0 );
begin
);
xsub, ysub );
);
end kalkulator_arc;
Blok mux.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity mux is
);
end mux;
begin
begin
else
end if;
end process;
end mux_arc;
Blok comparator.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity comparator is
x, y: in std_logic_vector( 3 downto 0 );
);
end comparator;
begin
process( x, y, rst )
begin
else
end if;
end process;
end comparator_arc;
Blok regis.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity regis is
);
end regis;
begin
begin
end if;
end if;
end process;
end regis_arc;
Blok subtractor.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity subtractor is
x, y: in std_logic_vector( 3 downto 0 );
);
end subtractor;
begin
process(rst, cmd, x, y)
begin
xout <= ( x - y );
yout <= y;
xout <= x;
yout <= ( y - x );
else
yout <= y;
end if;
end process;
end subtractor_arc;
Blok fsm.vhd
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity fsm is
);
end fsm;
begin
begin
end if;
end process;
begin
case cState is
else
end if;
when s0 => enable <= '0';
end if;
end case;
end process;
end fsm_arc;
- ----
when s2 => xld <= '0';
yld <= '0';
if( comparison = "10" ) then
nState <= s3;
elsif( comparison = "01" ) then
nState <= s5;
elsif( comparison = "11" ) then
nState <= s3;
end if;
- - - - - - -
Subtractor.vhd
- --------
else
yout <= y;
- ------