📄 multiplex.v
字号:
module multiplex(Xs,X1p,X2p,X,clk,rst);/*复接*/
input Xs,X1p,X2p,clk;
input rst;
output X;
reg X;
reg [3:0]count;
/*电平触发程序*/
//always@(posedge clk or posedge rst)
//if(rst)count<=0; /*复位和设定计数器的初始化*/
//else
//begin
// if(count<6) /*复接开始*/
// begin
// X<=Xs;
// end
// else if(count>=6&&count<9)
// begin
// X<=X1p;
// end
// else if(count>=9&&count<12)
// begin
// X<=X2p;
// end
// else
// X<=0;
// if(count<12)
// count<=count+4'b0001;
//end
/*组合逻辑程序*/
always @(negedge clk or posedge rst) /*复位和设定计数器的初始化*/
if(rst)count<=0;
else
begin
if(count<12)count<=count+4'b0001;
end
always@(Xs or X1p or X2p)
begin
if(count<6)
begin
X<=Xs;
end
else if(count>=6&&count<9)
begin
X<=X1p;
end
else if(count>=9&&count<12)
begin
X<=X2p;
end
else
X<=0; /*使数据后面的数归0*/
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -