From d6f65268ff859a80667978af2d4f4f1623ff6c66 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 30 Jun 2014 02:40:31 +0200 Subject: Add many vhdl08 predefined operators and functions. Add std.env --- libraries/Makefile.inc | 2 +- libraries/std/env.vhdl | 28 +++++++++++++++++++ libraries/std/env_body.vhdl | 65 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 libraries/std/env.vhdl create mode 100644 libraries/std/env_body.vhdl (limited to 'libraries') diff --git a/libraries/Makefile.inc b/libraries/Makefile.inc index fed7457fa..5d1cc76f1 100644 --- a/libraries/Makefile.inc +++ b/libraries/Makefile.inc @@ -70,7 +70,7 @@ ieee2008/fixed_pkg.vhdl STD87_BSRCS := $(STD_SRCS:.vhdl=.v87) STD93_BSRCS := $(STD_SRCS:.vhdl=.v93) -STD08_BSRCS := $(STD_SRCS:.vhdl=.v08) +STD08_BSRCS := $(STD_SRCS:.vhdl=.v08) std/env.vhdl std/env_body.vhdl IEEE87_BSRCS := $(IEEE_SRCS:.vhdl=.v87) IEEE93_BSRCS := $(IEEE_SRCS:.vhdl=.v93) $(MATH_SRCS) SYNOPSYS87_BSRCS := $(SYNOPSYS_BSRCS) diff --git a/libraries/std/env.vhdl b/libraries/std/env.vhdl new file mode 100644 index 000000000..35cbb0261 --- /dev/null +++ b/libraries/std/env.vhdl @@ -0,0 +1,28 @@ +-- Std.Env package declaration. This file is part of GHDL. +-- This file was written from the clause 14.3 of the VHDL LRM. +-- Copyright (C) 2014 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GCC; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +package Env is + procedure Stop (Status : Integer); + procedure Stop; + + procedure Finish (status : Integer); + procedure Finish; + + function Resolution_Limit return Delay_Length; +end package Env; diff --git a/libraries/std/env_body.vhdl b/libraries/std/env_body.vhdl new file mode 100644 index 000000000..d36519fc9 --- /dev/null +++ b/libraries/std/env_body.vhdl @@ -0,0 +1,65 @@ +-- Std.Env package declaration. This file is part of GHDL. +-- This file was written from the clause 14.3 of the VHDL LRM. +-- Copyright (C) 2014 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GCC; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +package body Env is + procedure control_simulation (Is_Stop : Boolean; + Has_Status : Boolean; + Status : Integer); + attribute foreign of control_simulation : procedure is "GHDL intrinsic"; + + procedure control_simulation (Is_Stop : Boolean; + Has_Status : Boolean; + Status : Integer) is + begin + assert false report "must not be called" severity failure; + end control_simulation; + + procedure Stop (Status : Integer) is + begin + control_simulation (True, True, Status); + end Stop; + + procedure Stop is + begin + control_simulation (True, False, -1); + end Stop; + + procedure Finish (status : integer) is + begin + control_simulation (False, True, Status); + end Finish; + + procedure Finish is + begin + control_simulation (False, False, -1); + end Finish; + + function Get_Resolution_Limit return Delay_Length; + attribute foreign of Get_Resolution_Limit : function is "GHDL intrinsic"; + + function Get_Resolution_Limit return Delay_Length is + begin + assert false report "must not be called" severity failure; + end Get_Resolution_Limit; + + function Resolution_Limit return Delay_Length is + begin + return Get_Resolution_Limit; + end Resolution_Limit; +end package body Env; -- cgit v1.2.3