下列Verilog HDL程序所描述电路功能是 .module _4bit_cnt (CP,nCR,Q,Mod); input CP, nCR, Mod; output reg [3:0] Q; always @ (posedge CP or negedge nCR) if (~nCR) Q <= 4b0000; else if (Mod==1) Q <= Q + 1b1; elseQ <= Q - 1b1; endmodule
举一反三
- 下列Verilog HDL程序所描述电路功能是( )module ShiftReg (Q,Din,CP,CLR_); input Din; //Serial Data inputs input CP, CLR_; //Clock and Reset output reg [3:0] Q; //Register output always @ (posedge CP or negedge CLR_) if (!CLR_) Q <= 4b0000; else begin //Shift right Q[0] <= Din; Q[3:1] <= Q[2:0]; endendmodule
- 下面是一个4位的双向移位寄存器程序,该程序正确吗?module UniversalShift (S1,S0,Din,Dsl,Dsr,Q,CP,CLR_); input S1, S0; //Select inputs input Dsl, Dsr; //Serial Data inputs input CP, CLR_; //Clock and Reset input [3:0] Din; //Parallel Data input output [3:0] Q; //Register output reg [3:0] Q; always @ (posedge CP or negedge CLR_) if (~CLR_) Q <= 4b0000; else case ({S1,S0}) 2b00: Q <= Q; //No change 2b01: Q <= {Dsr,Q[3:1]}; //Shift right 2b10: Q <= {Q[2:0],Dsl}; //Shift left 2b11: Q <= Din; //Parallel load input endcaseendmodule
- 下列程序中的空格应为:。module CNT4 (CLK,Q);output [3:0] Q; input CLK;reg [3:0] Q ;always @(posedge ____)Q <;= Q+1 ;endmodule A: [3:1] B: CLK C: output D: Q
- module cnt32( input clk, output reg[31:0] q);always @(posedge clk) q = q + 1'b1;endmodule上述HDL程序是用什么语言写的? A: C++ B: Java C: Verilog D: VHDL
- module cnt32 ( input clk, output reg[31:0] q ); always @(posedge clk) q = q + 1'b1; endmodule 上述HDL程序是用什么语言写的?()。 A: VHDL B: Verilog C: Java D: C++