本人初次使用modelsim,想用分频代码测试一下,但无法输出波形,求大神解决方法;
vhdl代码:
process(clk)
begin
if(clk'event and clk='1')then
if(count1="00011001")then
clk1<=not clk1;
count1<="00000000";
else
count1<=count1+1;
end if;
if(count2="110010")then
clk2<=not clk2;
count2<="00000000";
else
count2<=count2+1;
end if;
end if;
end process;
clk_1M<=clk1;
clk_500k<=clk2;
testbench主要代码:
SIGNAL clk : STD_LOGIC:='0';
SIGNAL clk_1M : STD_LOGIC:='0';
SIGNAL clk_500k : STD_LOGIC:='0';
constant clk_period :time :=20 ns;
BEGIN
instant : fangzhen
PORT MAP (
-- list connections between master ports and signals
clk => clk,
clk_1M => clk_1M,
clk_500k => clk_500k
);
clk_gen : PROCESS
BEGIN
wait for clk_period/2;
clk<='1';
wait for clk_period/2;
clk<='0';
END PROCESS clk_gen;
仿真波形:
仿真得出波形
此帖出自
小平头技术问答
一周热门 更多>