Bài viết này tôi sẽ giới thiệu cách bên dịch và mô phỏng các entity trong VHDL hoặc các module trong Verilog bằng chương trình ModelSim
Các bạn có thể xem code sử dụng trong ví dụ này ở đây:
ETYTI CHÍNH
library ieee;
use ieee.std_logic_1164.all;
entity lab1_part1 is
port(
SW: IN std_logic_vector(0 to 2);
LED: OUT std_logic_vector(0 to 2));
end lab1_part1;
architecture behave of lab1_part1 is
begin
LED <= SW;
end behave;
testbench file
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
entity lab1_part1_tb is
end;
architecture bench of lab1_part1_tb is
component lab1_part1
port(
SW: IN std_logic_vector(0 to 2);
LED: OUT std_logic_vector(0 to 2));
end component;
signal SW: std_logic_vector(0 to 2);
signal LED: std_logic_vector(0 to 2);
begin
uut: lab1_part1 port map ( SW => SW,
LED => LED );
stimulus: process
begin
-- Put initialisation code here
SW <= "000";
-- Put test bench stimulus code here
wait for 10ns;
SW <= "101";
wait for 10ns;
SW <= "010";
wait for 10ns;
wait;
end process;
end;
Sau đó bạn có thể xem hai clip sau:
Bạn có đam mê ngành thiết kế vi mạch và bạn muốn có mức lương 1000 usd cùng lúc bạn
đang muốn tìm một Trung tâm để học vậy hãy đến với ngành vi mạch tại SEMICON
HotLine: 0972 800 931 Ms Duyên