From 8d5c9a328a7285c5457bf8fdfcb403b87db1e263 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 3 Dec 2015 21:04:42 +0100 Subject: openieee: add numeric_std and numeric_bit. --- src/ghdldrv/foreigns.adb | 38 +++++++++++++++++++++++++++++++++++++- src/ghdldrv/foreigns.ads | 17 +++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'src/ghdldrv') diff --git a/src/ghdldrv/foreigns.adb b/src/ghdldrv/foreigns.adb index 15e3dd0..0d6b19a 100644 --- a/src/ghdldrv/foreigns.adb +++ b/src/ghdldrv/foreigns.adb @@ -1,9 +1,41 @@ +-- GHDL driver - Foreign functions known by JIT. +-- Copyright (C) 2002 - 2015 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. with Interfaces.C; use Interfaces.C; package body Foreigns is + function Ceil (Arg : double) return double; + pragma Import (C, Ceil); + + function Floor (Arg : double) return double; + pragma Import (C, Floor); + + function Round (Arg : double) return double; + pragma Import (C, Round); + + function Trunc (Arg : double) return double; + pragma Import (C, Trunc); + function Sin (Arg : double) return double; pragma Import (C, Sin); + function Cos (Arg : double) return double; + pragma Import (C, Cos); + function Log (Arg : double) return double; pragma Import (C, Log); @@ -37,10 +69,14 @@ package body Foreigns is Addr : Address; end record; - Foreign_Arr : constant array (Natural range <>) of Foreign_Record := ( + (new String'("ceil"), Ceil'Address), + (new String'("floor"), Floor'Address), + (new String'("round"), Round'Address), + (new String'("trunc"), Trunc'Address), (new String'("sin"), Sin'Address), + (new String'("cos"), Cos'Address), (new String'("log"), Log'Address), (new String'("exp"), Exp'Address), (new String'("sqrt"), Sqrt'Address), diff --git a/src/ghdldrv/foreigns.ads b/src/ghdldrv/foreigns.ads index 5759ae4..1598311 100644 --- a/src/ghdldrv/foreigns.ads +++ b/src/ghdldrv/foreigns.ads @@ -1,3 +1,20 @@ +-- GHDL driver - Foreign functions known by JIT. +-- Copyright (C) 2002 - 2015 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. with System; use System; package Foreigns is -- cgit