A
Ann
Guest
I am trying to covert the following Verilog code to VHDL. I am having
issues with converting the arrays to VHDL. Could you please comment on
how this should be done
module FIFO16x8(DataOut, DataIn, FF, AF, HF, AE, EF, Push, Pop, Dump,
Clk);
parameter WIDTH = 8;
parameter DEPTH = 16;
parameter LOG2DEPTH = 4;
input [(WIDTH-1):0] DataIn;
output [(WIDTH-1):0] DataOut;
output FF, AF, HF, AE, EF;
input Push, Pop, Dump, Clk;
wire WE, RE;
reg [(LOG2DEPTH-1):0] Contents, ReadPointer, WritePointer;
reg [(WIDTH-1):0] queue[(DEPTH-1):0];
assign FF = (Contents == (DEPTH-1))? 1 : 0;
assign AF = (Contents > (DEPTH-3))? 1 : 0;
assign HF = (Contents > (DEPTH/2))? 1 : 0;
assign AE = (Contents < 3)? 1 : 0;
assign EF = (Contents == 0)? 1 : 0;
assign WE = Push && ~FF;
assign RE = Pop && ~EF;
assign DataOut = queue[ReadPointer];
always @ (posedge Clk)
begin
if (Dump == 1)
Contents <= 0;
else
if ((WE == 1) && (RE == 0))
Contents <= Contents + 1;
else
if ((WE == 0) && (RE == 1))
Contents <= Contents - 1;
else
Contents <= Contents;
end
always @ (posedge Clk)
begin
if (Dump == 1)
begin
ReadPointer <= 0;
WritePointer <= 0;
end
else
begin
if (RE == 1)
begin
ReadPointer <= ReadPointer + 1;
end
if (WE == 1)
begin
queue[WritePointer] <= DataIn;
WritePointer <= WritePointer + 1;
end
end
end
endmodule
I have declared an array in VHDL as follows
TYPE queue IS ARRAY (7 DOWNTO 0, 15 DOWNTO 0)
OF std_logic_vector(7 downto 0);
I am not sure about how to convert the Verilog statements belwo to
VHDL. Verilog code is referenced above.
assign DataOut = queue[ReadPointer];
and
queue[WritePointer] <= DataIn;
thanks
Anuja
issues with converting the arrays to VHDL. Could you please comment on
how this should be done
module FIFO16x8(DataOut, DataIn, FF, AF, HF, AE, EF, Push, Pop, Dump,
Clk);
parameter WIDTH = 8;
parameter DEPTH = 16;
parameter LOG2DEPTH = 4;
input [(WIDTH-1):0] DataIn;
output [(WIDTH-1):0] DataOut;
output FF, AF, HF, AE, EF;
input Push, Pop, Dump, Clk;
wire WE, RE;
reg [(LOG2DEPTH-1):0] Contents, ReadPointer, WritePointer;
reg [(WIDTH-1):0] queue[(DEPTH-1):0];
assign FF = (Contents == (DEPTH-1))? 1 : 0;
assign AF = (Contents > (DEPTH-3))? 1 : 0;
assign HF = (Contents > (DEPTH/2))? 1 : 0;
assign AE = (Contents < 3)? 1 : 0;
assign EF = (Contents == 0)? 1 : 0;
assign WE = Push && ~FF;
assign RE = Pop && ~EF;
assign DataOut = queue[ReadPointer];
always @ (posedge Clk)
begin
if (Dump == 1)
Contents <= 0;
else
if ((WE == 1) && (RE == 0))
Contents <= Contents + 1;
else
if ((WE == 0) && (RE == 1))
Contents <= Contents - 1;
else
Contents <= Contents;
end
always @ (posedge Clk)
begin
if (Dump == 1)
begin
ReadPointer <= 0;
WritePointer <= 0;
end
else
begin
if (RE == 1)
begin
ReadPointer <= ReadPointer + 1;
end
if (WE == 1)
begin
queue[WritePointer] <= DataIn;
WritePointer <= WritePointer + 1;
end
end
end
endmodule
I have declared an array in VHDL as follows
TYPE queue IS ARRAY (7 DOWNTO 0, 15 DOWNTO 0)
OF std_logic_vector(7 downto 0);
I am not sure about how to convert the Verilog statements belwo to
VHDL. Verilog code is referenced above.
assign DataOut = queue[ReadPointer];
and
queue[WritePointer] <= DataIn;
thanks
Anuja