求大神帮忙写一个此VHDL三角波信号发生器程序的Testbench程序。。万分感谢啊~~
三角波程序:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
EN
tiTY delta IS
port(clk,clrn:IN STD_LOGIC;
q:OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END delta;
ARCHITECTURE a OF delta IS
BEGIN
PROCESS(clk,clrn)
VARIABLE tmp:STD_LOGIC_VECTOR(7 DOWNTO 0);
VARIABLE f:STD_LOGIC;
BEGIN
IF clrn='0' THEN tmp:="00000000";
ELSIF clk'EVENT AND clk='1' THEN
IF f='0' THEN
IF tmp="11111110" THEN tmp:="11111111"; f:='1';
ELSE tmp:=tmp+1;
END IF;
ELSE
IF tmp ="00000001" THEN tmp:="00000000"; f:='0';
ELSE tmp:=tmp-1;
END IF;
END IF;
END IF;
q<=tmp;
END PROCESS;
END a;
一周热门 更多>