|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
先谢谢大侠,因为刚开始学习FPGA,对VHDL的仿真不够了解,请您多多指教!下面是看门狗顶层模块代码,求它的VHDL仿真代码,
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity wd is
PORT(
clk : IN STD_LOGIC;
start : IN STD_LOGIC;
wr : IN STD_LOGIC;
feeddog : IN STD_LoGIC;
data : IN STD_LOGIC_VECTOR(7 downto 0);
reset : OUT STD_LOGIC
);
end wd;
architecture structural of wd is
COMPONENT wdcmp
PORT(
start : IN STD_LOGIC;
clr : IN STD_LOGIC;
clk : IN STD_LOGIC;
wr : IN STD_LOGIC;
data : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
reset : IN STD_LOGIC
);
END COMPONENT;
COMPONENT wdclock
PORT(
--start : IN STD_LOGIC;
clkin : IN STD_LOGIC;
clr : IN STD_LOGIC;
clk1ms : IN STD_LOGIC
--data : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
--reset : IN STD_LOGIC;
);
END COMPONENT;
COMPONENT wddelay
PORT(
--start : IN STD_LOGIC;
clk : IN STD_LOGIC;
clr : IN STD_LOGIC;
clrall : BUFFER STD_LOGIC
--data : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
--reset : IN STD_LOGIC;
);
END COMPONENT;
SIGNAL clk1ms : STD_LOGIC;
SIGNAL clkcmp : STD_LOGIC;
SIGNAL reset_reg : STD_LOGIC;
SIGNAL clrall : STD_LOGIC;
SIGNAL clr : STD_LOGIC;
begin
U1: wdcmp
PORT MAP
(
start => start,
clr => clr,
clk => clk,
wr => wr,
data => data,
reset => reset_reg
);
U2: wdclock
PORT MAP
(
--start => start,
clkin => clk,
clr => clr,
clk1ms => clk1ms
--wr => wr,
--data => data,
--reset => reset_reg
);
U3: wddelay
PORT MAP
(
clk => clk1ms,
clr => reset_reg,
clrall => clrall
);
clr <= feeddog OR clrall;
clkcmp <= clk1ms AND NOT (reset_reg);
reset <= reset_reg;
end structural; |
|