- UID
- 1029342
- 性别
- 男
|
module D_EF(Q,D,CLK)
input D,CLK;
output Q;
reg Q; //在always语句中被赋值的信号要声明为reg类型 寄存器定义
always @ (posedge CLK) //上升沿,下降沿用negedge表示,^_^ 需要记忆
begin Q <= D; end
endmodule
module D_EF(q,qn,d,clk,set,reset)
input d,clk,set,reset;
output q,qn;
reg q,qn;//寄存器定义
always @ (posedge clk or negedge set or negedge reset)
begin
if(!reset) begin q<=0;qn<=1;end//异步清0,低有效
else if(!set) begin q<=1;qn<=1;end //异步置1,低有效
else begin q<=~d;qn<=~d;end
end
endmodule
module D_EF(q,qn,d,clk,set,reset)
input d,clk,set,reset;
output q,qn;
reg q,qn;
always @ (posedge clk)
begin
if(reset) begin q<=0;qn<=1;end//同步清0,高有效
else if(set) begin q<=1;qn<=1;end //同步置1,高有效
else begin q<=~d;qn<=~d;end
end
endmodule |
|