module shift(in,clk,en,clr,set,out);input [7:0]in; //input datainput clk; //input clockinput en; //历芹凯input enable high enableinput clr; //input clear low enableinput [2:0]set; //input set :set num of shift bitoutput [7:0]out;always@(posedge clk or negedge clr) begin: shift_reg if(!clr) //asychro reset_n low enable out <= 8'b0; else if(en) begin //enable signal case(set[2:0]) 3'b0: out <= in[7:0]; //no shift 3'b1: out <= {in[0],in[7:1]};//shift 1bit 3'd2: out <= {in[1:0],in[7:2];//肢唤shift 2bit ... ... /首罩/中间这段自己写,要是不会我就撞墙了 default: out <= in[7:0]; endcase endend