Abstrak
Abstrak mempelajari penggunaan 7 segment dengan BCD
decoder serta mengedipkan led pada FPGA dengan
pendekatan menggunakan bahasa VHDL. Bahasa VHDL
yang digunakan menjurus pada implementasi combinational
circuit, D-flip-flop, serta clock divider. Praktikum dilakukan
dengan bantuan software quartus prime, Modelsim dan Altera
Cyclone untuk membantu pemahaman terhadap praktikum.
Setelah praktikum didapat hasil sesuai spesifikasi serta
ketentuan yang diinginkan.
Kata kunci: VHDL, combinational circuit, D-flip-
flop, clock divider, Praktikum.
clockdiv 1 2 freq
0 - - disabled
1 0 0 0,125 Hz
1 0 1 0,25 Hz
1 1 0 0,5 Hz
1 1 1 1 Hz
Laporan Praktikum - Laboratorium Dasar Teknik Elektro – STEI ITB 3
LAMPIRAN
Link Video Praktikum https://youtu.be/JKzhr9LA7HQ
1. Source Code 3A
Variasi 1
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY bcd3 IS
PORT (
D0,D1,D2,D3 : IN bit;
A,B,C,D,E,F,G : OUT bit
display : out std_logic
);
END bcd3;
Variasi 2
library ieee;
use ieee.std_logic_1164.all;
entity bcd_7seg_decoder is
end bcd_7seg_decoder;
begin
end Behavioral;
Variasi 3
library ieee;
use ieee.std_logic_1164.all;
entity bcd_7seg_decoder is
Port ( bcd : in std_logic_vector (3 downto 0);
Seven_Segment : BUFFER std_logic_vector (6 downto 0);
digtubein : out std_logic_vector (3 downto 0));
end bcd_7seg_decoder;
begin
process(bcd)
begin
end process;
process(Seven_Segment,digtube)
begin
case Seven_Segment is
when "0000001" => digtube <= "1110";
when "1001111" => digtube <= "1110";
Laporan Praktikum - Laboratorium Dasar Teknik Elektro – STEI ITB 5
when "0010010" => digtube <= "1110";
when "0000110" => digtube <= "1110";
when "1001100" => digtube <= "1110";
when "0100100" => digtube <= "1110";
when "0100000" => digtube <= "1110";
when "0001111" => digtube <= "1110";
when "0000000" => digtube <= "1110";
when "0000100" => digtube <= "1110";
when others => digtube <= "1111";
end case;
end process;
digtubein <= digtube;
end Behavioral;
entity tb_bcd_7seg_decoder is
end tb_bcd_7seg_decoder;
component bcd_7seg_decoder
port(bcd : in std_logic_vector(3 downto 0);
Seven_Segment : out std_logic_vector(6 downto 0));
end component;
BEGIN
uut: bcd_7seg_decoder
port map(bcd => bcd,
Seven_Segment => Seven_Segment);
stim_proc: process
begin
end;
2. Source Code 3B
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity blinking_led is
port (
std_clock : in std_logic;
clockdiv : in std_logic;
button_1 : in std_logic;
button_2 : in std_logic;
led : out std_logic
);
end blinking_led;
-- counter signal:
signal r_freq_0_125hz : natural range 0 to c_freq_0_125hz;
signal r_freq_0_25hz : natural range 0 to c_freq_0_25hz;
signal r_freq_0_5hz : natural range 0 to c_freq_0_5hz;
signal r_freq_1hz : natural range 0 to c_freq_1hz;
begin
-
- led dapat digunakan saat input valid dari multiplexer dan clockdiv dinyalakan
led <= multiplexer and clockdiv;
end rtl;
Test Bench 3B
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity blinking_led_tb is
end blinking_led_tb;
-- 25 MHz = 40 ns (periode)
constant clock_period : time := 20 ns;
component blinking_led is
port (
std_clock : in std_logic;
clockdiv : in std_logic;
button_1 : in std_logic;
button_2 : in std_logic;
led : out std_logic);
end component blinking_led;
Laporan Praktikum - Laboratorium Dasar Teknik Elektro – STEI ITB 9
begin
DUT : blinking_led
port map (
std_clock => tb_clock,
clockdiv => tb_clockdiv,
button_1 => tb_button_1,
button_2 => tb_button_2,
led => tb_led
);
clk_gen : process is
begin
wait for clock_period/2;
tb_clock <= not tb_clock;
end process clk_gen;
process
begin
tb_clockdiv <= '1';
end process;
end behave;