L
Lily
Guest
Hello,
I need to verify my ALU. I have generate the input text file which
consits of 20 bits as follows :
4 bit - opcode
8 bit - operandA
8 bit - operandB
what is the best way to read the input text file which consist of 2 to
the power of 20 combinational test cases. please give example in vhdl.
can i just read the test vectors by each line as code below
file infile : text is in "input.txt";
variable aluinput : std_logic_vector(19 downto 0);
variable buff : line;
begin -- process
if rst = '0' then
A <= "00000000";
B <= "00000000";
elsif clock'event and clock = '1' then
if not (endfile(infile)) then
readline(infile,buff);
read(buff,aluinput);
A <= aluinput(7 downto 0);
B <= aluinput(15 downto 8);
S <= aluinput(19 downto 16);
end if;
end if;
is this the efficient way or are there any other alternatives ?
does anybody out there know how to read the input text file in C model
?
thanks in advance. lily.
I need to verify my ALU. I have generate the input text file which
consits of 20 bits as follows :
4 bit - opcode
8 bit - operandA
8 bit - operandB
what is the best way to read the input text file which consist of 2 to
the power of 20 combinational test cases. please give example in vhdl.
can i just read the test vectors by each line as code below
file infile : text is in "input.txt";
variable aluinput : std_logic_vector(19 downto 0);
variable buff : line;
begin -- process
if rst = '0' then
A <= "00000000";
B <= "00000000";
elsif clock'event and clock = '1' then
if not (endfile(infile)) then
readline(infile,buff);
read(buff,aluinput);
A <= aluinput(7 downto 0);
B <= aluinput(15 downto 8);
S <= aluinput(19 downto 16);
end if;
end if;
is this the efficient way or are there any other alternatives ?
does anybody out there know how to read the input text file in C model
?
thanks in advance. lily.