xpratx
Junior Member level 3
hi i am trying this swap code
i define "word" as it will be input and output both but now i cannot define it as "reg" and also there comes an error in swap instruction.
is there any way around it??
i know trying input and output for "word" didn't help.
module swap(clock,word);
input clock;
inout [15:0] word;
reg [15:0] word;
always @(posedge clock)
begin
word[15:8] <= word[7:0];
word[7:0] <= word[15:8];
end
endmodule
i define "word" as it will be input and output both but now i cannot define it as "reg" and also there comes an error in swap instruction.
is there any way around it??
i know trying input and output for "word" didn't help.
module swap(clock,word);
input clock;
inout [15:0] word;
reg [15:0] word;
always @(posedge clock)
begin
word[15:8] <= word[7:0];
word[7:0] <= word[15:8];
end
endmodule