always@(posedge clk) begin
if(rst)
data <= 1'b0;
else begin
case(sel)
2'b00:
data <= data_in[0];
2'b01:
data <= data_in[1];
2'b10:
data <= data_in[2];
2'b11:
data <= data_in[3];
default:
data <= data;
endcase
end
always@(posedge clk) begin
if(rst)
data <= 1'b0;
else
begin
if(sel == 2'b00)
data <= data_in[0];
else
if(sel==2'b01)
data <= data_in[1];
else
if(sel==2'b10)
data <= data_in[2];
else
if(sel==2'b11)
data <= data_in[3];
end
文章评论(0条评论)
登录后参与讨论