快乐学习
一个网站喵查铺子(catpuzi.com)全搞定~
> 中国大学MOOC答案 > 下面是一个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 <= 4'b0000; else case ({S1,S0}) 2’b00: Q <= Q; //No change 2’b01: Q <= {Dsr,Q[3:1]}; //Shift right 2’b10: Q <= {Q[2:0],Dsl}; //Shift left 2’b11: Q <= Din; //Parallel load input endcaseendmodule
-->
A、正确
B、错误
喵查答案:正确