请教一个程序
时间:10-02
整理:3721RD
点击:
功能如下:当无时钟脉冲输入到控制器时,控制器就输出为“0”,只要由一个脉冲触发它时,则它的输出就是“1”,而且这个“1”是永远保持下去
library ieee;
use ieee.std_logic_1164.all;
entity keyon is
port(en:in std_logic;
qut std_logic);
end entity keyon;
architecture one of keyon is
begin
process(en)
begin
if (en'event) and (en='1') then
q<='1';
end if;
end process;
end architecture one;
我的波形是全为高电平,这是为什么呢?
library ieee;
use ieee.std_logic_1164.all;
entity keyon is
port(en:in std_logic;
qut std_logic);
end entity keyon;
architecture one of keyon is
begin
process(en)
begin
if (en'event) and (en='1') then
q<='1';
end if;
end process;
end architecture one;
我的波形是全为高电平,这是为什么呢?
q初值为1
q初值为1?怎么做?
在程序中加入复位信号,复位时把q置为低电平
module SR_Latch(in,rst,q);
input in; // pulse signal input
input rst; // output reset signal(high active)
output q; // edge detection output. high active
always@(in or rst)
begin
if( rst == 1'b1)
q = #1 1'b0;
else
begin
if ( in == 1'b1)
q = #1 1'b1;
end
end
endmodule
