Tuan
unread,Nov 7, 2011, 10:31:30 AM11/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to thietkeVLSI20111
module shift_reg(
data_in,
clk,
d,
data_out
);
// input
input [7:0] data_in;
input clk;
input d;
//output
output [7:0] data_out;
//reg
reg [7:0] data_out;
always @ (posedge clk)
begin
if (d)
data_out <= { data_in[7],data_in[5:0],1'b0 };// d=1 thi dich trai.
else
data_out <= { data_in[7],data_in[7:1]};// d= 0 thi dich phai
end
endmodule