- UID
- 85436
- 性别
- 男
|
我想在时钟的上升沿和下降沿都执行相应操作,这样编行不行?高手指点!
module ENCODER(rst,clk,data_nrz,data_cmi);
input data_nrz,clk,rst;
output data_cmi;
reg data_cmi,be_data1;
always @(clk)
if(!rst)
begin
data_cmi<=1;
be_data1<=0;
end
else
begin
@(posedge clk)
if(data_nrz==1'b0)
data_cmi<=1'b0;
else
data_cmi<=~be_data1;
be_data1<=~be_data1;
@(negedge clk)
if(data_nrz==1'b0)
data_cmi<=1'b1;
else;
end
endmodule |
|