Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vhdl file handling......................

Status
Not open for further replies.

velu.plg

Member level 5
Joined
Jul 30, 2013
Messages
93
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
chennai
Activity points
1,974

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;
    use ieee.std_logic_textio.all;
    use std.textio.all;
 
entity rom_using_file is
GENERIC (N :INTEGER:=260);
    port (
        ce,clk ,clk1,read      :in  std_logic;                     -- Chip Enable
        read_en :in  std_logic;                     -- Read Enable
        address :in integer; -- Address input
        data    :out integer;  -- Data output
        ram1 : inout integer;
        c : inout std_logic
    );
end entity;
architecture behavior of rom_using_file is
 
    -- RAM block 8x256
    type RAM is array (0 to (N-1), 0 to (N-1) )of integer;
    signal mem : RAM ;
    signal inc_row,inc_colom : integer:=0;
    file f1 :text open write_mode is "F:\vlsi project\AV00 _samplecode\imageprocessing\in1.txt";
    -- Subprogram to read a text file into RAM --
    procedure Load_ROM (signal data_word :inout RAM) is
        -- Open File in Read Mode
        file romfile   :text open read_mode is "F:\vlsi project\AV00  _samplecode\imageprocessing\indata.txt";
        
        variable lbuf  :line;
        variable i,j   :integer := 0;
        variable fdata :integer;
    begin
        while not endfile(romfile) loop
            -- read digital data from input file
            readline(romfile, lbuf);
            read(lbuf, fdata);
            data_word(i,j) <= fdata;
            if (clk = '1')then
            i := i+1;
            if (i=(N-1)) then
            j := j+1;
            i:=0;
          end if;
          end if;
          end loop;
           
    end procedure;
 
begin
 
    -- Procedural Call --
    Load_ROM(mem);
    
    process(clk1)
      variable buf : line;
      variable i1 :integer;
      begin
        
        ram1 <= mem(inc_row,inc_colom);
        i1 := ram1;
        
    if (clk1='1')then
      inc_colom <= inc_colom + 1;
      if (inc_colom = 5)then
        inc_row <= inc_row + 1;
      if (read ='1')then
      write (buf ,i1);
      writeline (f1,buf);
    end if;
    end if;
    end if;
    
  end process;




this is my code ...
how to rectify this error ????

** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(44): Prefix of indexed name must be an array.
** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(290): VHDL Compiler exiting
 
Last edited by a moderator:

You cannot call a procedure outside of a process.

You also need a 'event statement anded with clk = '1' for a proper synchronous process.
 

thanks for ur interest...

same error is occur...


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_unsigned.all;
    use ieee.std_logic_textio.all;
    use std.textio.all;
 
entity rom_using_file is
GENERIC (N :INTEGER:=260);
    port (
        ce,clk ,clk1,read      :in  std_logic;                     -- Chip Enable
        read_en :in  std_logic;                     -- Read Enable
        address :in integer; -- Address input
        data    :out integer;  -- Data output
        ram1 : inout integer;
        c : inout std_logic
    );
end entity;
architecture behavior of rom_using_file is
 
    -- RAM block 8x256
    type RAM is array (0 to (N-1), 0 to (N-1) )of integer;
    signal mem : RAM ;
    signal inc_row,inc_colom : integer:=0;
    file f1 :text open write_mode is "F:\vlsi project\AV00 _samplecode\imageprocessing\in1.txt";
    -- Subprogram to read a text file into RAM --
    procedure Load_ROM (signal data_word :inout RAM) is
        -- Open File in Read Mode
        file romfile   :text open read_mode is "F:\vlsi project\AV00  _samplecode\imageprocessing\indata.txt";
        
        variable lbuf  :line;
        variable i,j   :integer := 0;
        variable fdata :integer;
    begin
        while not endfile(romfile) loop
            -- read digital data from input file 
            readline(romfile, lbuf);
            read(lbuf, fdata);     ------------ [error line:44th] 
            data_word(i,j) <= fdata;
            if (clk'event and clk  = '1')then
            i := i+1;
            if (i=(N-1)) then
            j := j+1;
            i:=0;
          end if;
          end if;
          end loop;
           
    end procedure;
 
begin
 
    -- Procedural Call --
    Load_ROM(mem);
    
    process(clk1)
      variable buf : line;
      variable i1 :integer;
      begin
        
        ram1 <= mem(inc_row,inc_colom);
        i1 := ram1;
        
    if (clk1='1')then
      inc_colom <= inc_colom + 1;
      if (inc_colom = 5)then
        inc_row <= inc_row + 1;
      if (read ='1')then
      write (buf ,i1);
      writeline (f1,buf);
    end if;
    end if;
    end if;
    
  end process;


error:

** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(44): Prefix of indexed name must be an array.
** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(289): VHDL Compiler exiting

how can i solve it ????
 
Last edited by a moderator:

Ive got a feeling of deja Vu.

You cannot call a procedure outside a process.
 

In addition to what TrickyDicky said, you cannot call a procedure outside a process.
 

how to rectify this error ????

** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(44): Prefix of indexed name must be an array.
** Error: F:/vlsi project/AV00 _samplecode/imageprocessing/rom.vhdl(290): VHDL Compiler exiting
1. Are you sure that line 44 that is being flagged is line 44 in your posted code? In the code that you posted, line 44 is an "end if" statement which would not cause the error that you reported. Re-compile and double check exactly which line of code is being flagged and post it here if you want some help.

Unrelated to your question: In your 'Load_ROM' procedure
- Did you really want those spaces in your file name?
- If you intend to synthesize this code, do you really intend to have a two dimensional array of 32 bit integers? RAM is a one dimensional array, not two. If you're implementing a two dimensional structure, you will need to restructure it as a one dimensional array in order to synthesize to internal RAM. If not, the 2d array will be implemented with flip flops...lots of them.
- The "if (clk = '1')then" needs to be removed. Your procedure outputs a table which is performed statically, there should be no dependency on 'clk'.

Kevin Jennings

- - - Updated - - -

Ive got a feeling of deja Vu.

You cannot call a procedure outside a process.

Yes you can....yes you can.

Kevin Jennings
 

thanks for ur interest sir,

error line --- 37

i am a stranger for image processing (vhdl+matlab)

i covert the image into pixel using matlab and this is stored in text file (it contain 20700 integer value).

then i want to read that file into memory and perform sobel edge detection using modelsim software.

so , i need to move the sobel operator in that memory ...

this is correct format ?? or give the idea to me...
 

Yes you can....yes you can.

Kevin Jennings

Dont know why I had it in my head you could not. :S


Velu: I dont really know what you're asking. Your code discribes a rom - there is no transformation in the code. I have no idea what the image is, or the format. WHat you describe seems to just be an image streamer. You're starting sort of the right lines, but you have many problems just trying to read the data from a file. Have you even started writing the sobel edge detection yet?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top