demultiplex.v

来自「是用verilog写的,解复接程序,可以把复接的反过来,一般用在解码程序中!」· Verilog 代码 · 共 38 行

V
38
字号
module demultiplex(normal,Le,P1e,P2e,clk,rst);/*解复子函数*/
input normal,clk,rst;
output Le,P1e,P2e;
reg Le,P1e,P2e;
reg [3:0]count;
always@(posedge clk or posedge rst)/*设定计数器和复位*/
if(rst)count<=0;
else
   if(count<12) count<=count+4'b0001;

always@(normal)
begin
if(count<6)
 begin
  Le<=normal;         /*防止其他两个输出的随机变化*/
  P1e<=0;
  P2e<=0;
 end
else if(count>=6&&count<9) 
begin
 P1e<=normal;
 Le<=0;
 P2e<=0;
end
else if(count>=9&&count<12)
begin
 P2e<=normal;
 Le<=0;
 P1e<=0;
end
else
  begin
 P1e<=0;              /*将所得的数据后面的数复位*/
 Le<=0;
 P2e<=0;
end
end
endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?