Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

VHDL Protected type help

Hi everyone,..

I'm new in VHDL and FPGA, sorry for my lame question.

Here I have a project, and I thing I will need to use shared variable, here is the code I made :

--- Quote Start ---

library ieee;

use ieee.std_logic_1164.all;

-- Shared Function

package shared_function is

type sh_data is protected

procedure reset;

procedure set(signal new_data : std_logic);

impure function get_data return std_logic;

end protected sh_data;

end shared_function;

package body shared_function is

type sh_data is protected body

variable data : std_logic;

procedure reset is

begin

data := '0';

end reset;

procedure set(signal new_data : std_logic) is

begin

data := new_data;

end procedure;

impure function get_data return std_logic is

begin

return data;

end function;

end protected body sh_data;

end shared_function;

--- Quote End ---

When I perform "Start Compilation" or "Analyze Current File" in Quartus II Processing menu, I got these error messages :

--- Quote Start ---

Error (10500): VHDL syntax error at shared_function.vhd(6) near text "protected"; expecting "(", or "access", or "array", or "file", or "range", or "record"

Error (10500): VHDL syntax error at shared_function.vhd(10) near text "protected"; expecting ";", or an identifier ("protected" is a reserved keyword), or "package"

Error (10523): Ignored construct shared_function at shared_function.vhd(5) due to previous errors

Error (10500): VHDL syntax error at shared_function.vhd(14) near text "protected"; expecting "(", or "access", or "array", or "file", or "range", or "record"

Error (10500): VHDL syntax error at shared_function.vhd(31) near text "protected"; expecting ";", or an identifier ("protected" is a reserved keyword), or "package"

Error: Quartus II Analyze Current File was unsuccessful. 5 errors, 0 warnings

Error: Peak virtual memory: 185 megabytes

Error: Processing ended: Mon Mar 22 20:38:45 2010

Error: Elapsed time: 00:00:07

Error: Total CPU time (on all processors): 00:00:01

--- Quote End ---

I use Altera Quartus II version 9.1 SP1 Subscription Edition and I have changed the VHDL input to VHDL 2008.

Really, I don't understand at all, someone help me, please tell me what makes it error,

Any kind of help will be greatly appreciated...

Thanks :)

14 Replies