Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Reading in integers in VHDL

Name: Bubba 2011-04-07 20:11

I need to read in integer values from a text file, my current test text file just consists of the following:
1 2 3
4 5 6
7 8 9

I'm using Xilinx Webpack 10.1 (old I know, but that's what my school uses and I need to keep the same version for compatibility) and I keep getting an error that says "read of integer is not supported" and cannot for the life of me figure out why...Source code below, any help is appreciated :)

use STD.TEXTIO.all;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_TEXTIO.ALL;
use IEEE.numeric_bit.ALL;
use IEEE.numeric_std.ALL;


entity ConvInput is
end ConvInput;

architecture Behavioral of ConvInput is

TYPE matrix2 IS ARRAY(0 to 2, 0 to 2) of integer;
SIGNAL matrixk    : matrix2;
FILE k: TEXT IS IN "conv.txt";
SIGNAL  init    : BIT := '1';

begin

init_memory: PROCESS (init)
VARIABLE    intk         : integer := 0;
VARIABLE buffk        : line;
VARIABLE spacek    : CHARACTER;
VARIABLE rowk        : INTEGER := 0;
VARIABLE spot        : INTEGER := 0;

BEGIN
IF init='1' THEN init <= '0';


    if rowk < 3 then
        readline(k, buffk);
        for k in 0 to 2 loop
            read (buffk,intk);
            read (buffk,spacek);
            matrixK(rowk, k) <= intk;
   end loop;
   rowk := rowk + 1;
        else
        spot := spot + 1;
    end if;
end if;
end process;
end Behavioral;

Name: Anonymous 2011-04-07 20:12

It says the error is on this line if it helps any:
read (buffk,intk);

Name: Anonymous 2011-04-07 20:16

Use code tags.

Name: Anonymous 2011-04-07 20:18

Sorry, new to the Prog board, no idea how...

Name: Anonymous 2011-04-07 20:30

[code][/code]

Name: Anonymous 2011-04-07 21:31

Well good to know, it's a little late now though...any ideas on the program?

Name: Anonymous 2011-04-07 21:36

>>6
Read as string and convert it to a string manually?

Name: Anonymous 2011-04-07 21:38

>>7
s/to a string/to an integer/

Name: Anonymous 2011-04-07 21:42

I shouldn't have to read it in as a string.  No matter what Xilinx says, I know it's possible to read in a integer (another group with the same project has theirs working).

Name: Anonymous 2011-04-08 11:07

>>9
You HAVE to read it in as a string initially if it's an integer encoded as text. There's no two ways about it.

Don't change these.
Name: Email:
Entire Thread Thread List