martijn
Newbie level 4
copy partial variable
I've got this code:
input datain;
input clock;
output [0:5] data0;
output [0:5] data1;
output dir0;
output dir1;
// {{ALTERA_IO_END}} DO NOT REMOVE THIS LINE!
reg [0:7] shift;
reg [0:2] posi;
reg [0:5] data0;
reg [0:5] data1;
reg dir0;
reg dir1;
always @(negedge clock)
begin
shift[posi]= datain;
posi<=posi+1;
if (posi==3'd0)
begin
if (shift[0]==0)
begin
dir0<=shift[1];
data0<=shift[2:7];
end
else
begin
dir1<=shift[1];
data1<=shift[2:7];
end
end
end
is this part:
dir0<=shift[1];
data0<=shift[2:7];
good if I want to have dir0 the value of the 2nd bit of shift,
and data0 the value of the last 5 bits of shift?
thanks in advance.
Martijn
I've got this code:
input datain;
input clock;
output [0:5] data0;
output [0:5] data1;
output dir0;
output dir1;
// {{ALTERA_IO_END}} DO NOT REMOVE THIS LINE!
reg [0:7] shift;
reg [0:2] posi;
reg [0:5] data0;
reg [0:5] data1;
reg dir0;
reg dir1;
always @(negedge clock)
begin
shift[posi]= datain;
posi<=posi+1;
if (posi==3'd0)
begin
if (shift[0]==0)
begin
dir0<=shift[1];
data0<=shift[2:7];
end
else
begin
dir1<=shift[1];
data1<=shift[2:7];
end
end
end
is this part:
dir0<=shift[1];
data0<=shift[2:7];
good if I want to have dir0 the value of the 2nd bit of shift,
and data0 the value of the last 5 bits of shift?
thanks in advance.
Martijn