Trung tâm đào tạo thiết kế vi mạch Semicon


  • ĐĂNG KÝ TÀI KHOẢN ĐỂ TRUY CẬP NHIỀU TÀI LIỆU HƠN!
  • Create an account
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
semicon_lab.jpg

Thực hành VHDL Số 1 (Code và Mô phỏng)

E-mail Print PDF

Tổng hợp các bài viết về lập trình VHDL

 

 

 

Bài 1: Thiết kế RSFF đồng bộ tín hiệu Rst

Code :

library IEEE;

use IEEE.STD_LOGIC_1164.all;

 

entity RSFF_DB is

port(

R : in STD_LOGIC;

S : in STD_LOGIC;

RST : in STD_LOGIC;

CLK : in STD_LOGIC;

Q : out STD_LOGIC

);

end RSFF_DB;

 

–}} End of automatically maintained section

 

architecture RSFF_DB of RSFF_DB is

signal q0: std_logic;

begin

process (CLK,RST,R,S)

variable RS:std_logic_vector (1 downto 0);

begin

RS:=R&S;

if (CLK’event and CLK=’1′) then

if (RST=’1′) then

q0<=’0′;

else

case RS is

when “00”=>q0<=q0;

when “01”=>q0<=’1′;

when “10”=>q0<=’0′;

when others=>q0<=’X’;

end case;

end if;

end if;

end process;

Q<=q0;

— enter your statements here —

end RSFF_DB;

Mô phỏng :

 

Bài 2: Thiết kế RSFF không đồng bộ tín hiệu Rst

Code :

 

library IEEE;

use IEEE.STD_LOGIC_1164.all;

 

entity RSFF is

port(

R : in STD_LOGIC;

S : in STD_LOGIC;

RST : in STD_LOGIC;

CLK : in STD_LOGIC;

Q : out STD_LOGIC

);

end RSFF;

 

–}} End of automatically maintained section

 

architecture RSFF of RSFF is

signal q0: std_logic;

begin

process (CLK,RST,R,S)

variable RS:std_logic_vector (1 downto 0);

begin

RS:=R&S;

if (RST=’1′) then

q0<=’0′;

else if (CLK’event and CLK=’1′) then

case RS is

when “00”=>q0<=q0;

when “01”=>q0<=’1′;

when “10”=>q0<=’0′;

when others=>q0<=’X’;

end case;

end if;

end if;

end process;

Q<=q0;

end RSFF;

Mô phỏng :

 

Bài 3: DFF đồng bộ tín hiệu RST

Code :

library IEEE;

use IEEE.STD_LOGIC_1164.all;

 

entity DFF is

port(

d : in STD_LOGIC;

rst : in STD_LOGIC;

clk : in STD_LOGIC;

q : out STD_LOGIC

);

end DFF;

 

–}} End of automatically maintained section

 

architecture DFF of DFF is

begin

process(clk,rst,d)

begin

if(clk’event and clk=’1′) then

if(rst=’1′) then

q<=’0′;

else

q<=d;

end if;

end if;

end process;

end DFF;

Mô phỏng :

Nguồn: phamthanh92

    Bạn Có Đam Mê Với Vi Mạch hay Nhúng      -     Bạn Muốn Trau Dồi Thêm Kĩ Năng

    Mong Muốn Có Thêm Cơ Hội Trong Công Việc

     Và Trở Thành Một Người Có Giá Trị Hơn

    Bạn Chưa Biết Phương Thức Nào Nhanh Chóng Để Đạt Được Chúng

    Hãy Để Chúng Tôi Hỗ Trợ Cho Bạn. SEMICON  

      

    Hotline: 0972.800.931 - 0938.838.404 (Mr Long)

 

Last Updated ( Wednesday, 19 June 2019 19:57 )  

Related Articles

Chat Zalo