rsynch.vhd

来自「4位MCU AM2901的完整VHDL程序」· VHDL 代码 · 共 53 行

VHD
53
字号
-- synchronizers
-- 
-- clk--posedge clock input
-- reset--asynchronous reset(rsynch)
-- preset--asynchronous preset(psynch)
-- d--signal to synchronize
-- q--synchronized
--------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;

entity rsynch is port
(clk,reset:in std_logic;
 d:in std_logic;
 q:buffer std_logic);
end rsynch;

architecture archrsynch of rsynch is
signal temp:std_logic;
begin
process(reset,clk)
begin
if reset='1' then
   q<='0';
elsif rising_edge(clk) then
      temp<=d;
      q<=temp;
end if;
end process;
end archrsynch;
---------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;

entity psynch is port
(clk,preset:in std_logic;
 d:in std_logic;
 q:buffer std_logic);
end psynch;

architecture archpsynch of psynch is
signal temp:std_logic;
begin
process(preset,clk)
begin
if preset='1' then
   q<='1';
elsif rising_edge(clk) then
      temp<=d;
      q<=temp;
end if;
end process;
end archpsynch;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?