请用Verilog HDL对上图所示的2选1选择电路进行代码描述。主要的verilog代码已列出,请将空格部分补充完整。 module mux2_1 (s,x,y,q); input s,___,y; output ____; _______ q; always @(s,x,y) begin if(___) q=y; ______ q=x; end ___________31223e9c1d065adb6dcc509093b54e20.png
举一反三
- 下面是四选一数据选择器的部分代码,要补全代码可以选择( )。(?)always@(*)begin if (s==2'b00) y=p0; else if (s==2'b01) y=p1; else if (s==2'b10) y=p2; else y=p3;end A: module mux4_1 (p3,p2,p1,p0,s,y);input p3,p2,p1,p0;input[1:0] s;output y;... ...endmodule B: module mux4_1 (p3,p2,p1,p0,s,y);input p3,p2,p1,p0;input[1:0] s;output y;reg y;... ...endmodule C: module mux4_1 ( input p3,p2,p1,p0; input[1:0] s; output reg y;)... ...endmodule D: module mux4_1 (input p3,p2,p1,p0;input[1:0] s;output y )... ...endmodule
- 请用Verilog HDL对上图所示的半加器进行代码描述。主要的verilog代码已列出,请将空格部分补充完整。 module h_adder (a,b,sum,cout); ________ a,b; output sum,________; ______ x1(sum,a,b); ______ a1(cout,____,b); _______________b941d8b3a203f68eb8d2235e939f941c.png
- 【单选题】公式(∀x)[P(x)∧Q(x, A) →(∃y)[R(x, y)∨S(y)]]中,∀x的辖域为 , ∃y的辖域为 。 A. P(x); R(x, y) B. P(x)∧Q(x, A); R(x, y) C. P(x)∧Q(x, A)→(∃y)[R(x, y)∨S(y)]; R(x, y) D. P(x)∧Q(x, A)→(∃y)[R(x, y)∨S(y)]; R(x, y)∨S(y)
- 公式("x) ($y)(P(x,z)→Q(y))→S(x,y)中的约束变元进行换名,正确的是 A: ("x) ($y) (P(x,u)→Q(y))→S(x,y) B: ("x) ($v)(P(u,z)→Q(v))→S(u,v) C: ("u) ($v) (P(u,z)→Q(v))→S(x,y) D: ("u) ($v)(P(u,t)→Q(v))→S(u,v)
- 下面为某可变计数器的Verilog HDL代码,当A=1时,为7进制;当A=0时,为9进制。试补充完空白处代码。 module Alterable_Counter(A, clk, Q); input clk, A; output reg [3:0] Q; parameter N=7; parameter M=9; always @(posedge clk) begin if(A) begin if (__________) begin Q<=0; end else begin Q<=_______; end end else begin if (___________) begin Q<=0; end else begin Q<=Q+1; end end end endmodule