diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-12-10 06:13:43 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-12-11 07:25:09 +0100 |
commit | 4fff959635de496261c74a8c06b794a034fcce98 (patch) | |
tree | 2ae1613975e860685894096425c212c3a7e99682 /testsuite/gna/issue202 | |
parent | b9f0289559e16f788262fb33a29a66253d5bc3ec (diff) | |
download | ghdl-4fff959635de496261c74a8c06b794a034fcce98.tar.gz ghdl-4fff959635de496261c74a8c06b794a034fcce98.tar.bz2 ghdl-4fff959635de496261c74a8c06b794a034fcce98.zip |
Add testcase for #202
Diffstat (limited to 'testsuite/gna/issue202')
-rw-r--r-- | testsuite/gna/issue202/ScoreboardGenericPkg.vhd | 124 | ||||
-rw-r--r-- | testsuite/gna/issue202/repro.vhdl | 48 | ||||
-rwxr-xr-x | testsuite/gna/issue202/testsuite.sh | 14 |
3 files changed, 186 insertions, 0 deletions
diff --git a/testsuite/gna/issue202/ScoreboardGenericPkg.vhd b/testsuite/gna/issue202/ScoreboardGenericPkg.vhd new file mode 100644 index 000000000..93525fe21 --- /dev/null +++ b/testsuite/gna/issue202/ScoreboardGenericPkg.vhd @@ -0,0 +1,124 @@ +-- +-- File Name: ScoreBoardGenericPkg.vhd +-- Design Unit Name: ScoreBoardGenericPkg +-- Revision: STANDARD VERSION +-- +-- Maintainer: Jim Lewis email: jim@synthworks.com +-- Contributor(s): +-- Jim Lewis email: jim@synthworks.com +-- +-- +-- Description: +-- Defines types and methods to implement a FIFO based Scoreboard +-- Defines type ScoreBoardPType +-- Defines methods for putting values the scoreboard +-- +-- Developed for: +-- SynthWorks Design Inc. +-- VHDL Training Classes +-- 11898 SW 128th Ave. Tigard, Or 97223 +-- http://www.SynthWorks.com +-- +-- Latest standard version available at: +-- http://www.SynthWorks.com/downloads +-- +-- Revision History: +-- Date Version Description +-- 12/2006: 2006.12 Initial revision +-- 08/2010 2010.08 Added Tailpointer +-- 05/2012 2012.05 Changed FIFO to store pointers to ExpectedType +-- Allows usage of unconstrained arrays +-- 08/2012 2012.08 Added Type and Subprogram Generics +-- 08/2013 2013.08 Generics: to_string replaced write, Match replaced check +-- Added Tags - Experimental +-- Added Array of Scoreboards +-- 09/2013 2013.09 Added file handling, Check Count, Finish Status +-- Find, Flush +-- 06/2015 2015.06 Added Alerts, SetAlertLogID, Revised LocalPush, GetDropCount, +-- Deprecated SetFinish and ReportMode - REPORT_NONE, FileOpen +-- Deallocate, Initialized, Function SetName +-- 09/2016 2016.07 Released as part of OSVVM + +-- +-- +-- Copyright (c) 2006 - 2016 by SynthWorks Design Inc. All rights reserved. +-- +-- Verbatim copies of this source file may be used and +-- distributed without restriction. +-- +-- This source file is free software; you can redistribute it +-- and/or modify it under the terms of the ARTISTIC License +-- as published by The Perl Foundation; either version 2.0 of +-- the License, or (at your option) any later version. +-- +-- This source 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 Artistic License for details. +-- +-- You should have received a copy of the license with this source. +-- If not download it from, +-- http://www.perlfoundation.org/artistic_license_2_0 +-- +-- + +use std.textio.all ; + +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +package ScoreboardGenericPkg is + generic ( + type ExpectedType ; + type ActualType ; + function Match(Actual : ActualType ; -- defaults + Expected : ExpectedType) return boolean ; -- is "=" ; + function expected_to_string(A : ExpectedType) return string ; -- is to_string ; + function actual_to_string (A : ActualType) return string -- is to_string ; + ) ; + +-- -- For a VHDL-2002 package, comment out the generics and +-- -- uncomment the following, it replaces a generic instance of the package. +-- -- As a result, you will have multiple copies of the entire package. +-- -- Inconvenient, but ok as it still works the same. +-- subtype ExpectedType is std_logic_vector ; +-- subtype ActualType is std_logic_vector ; +-- alias Match is std_match [ActualType, ExpectedType return boolean] ; -- for std_logic_vector +-- alias expected_to_string is to_hstring [ExpectedType return string]; -- VHDL-2008 +-- alias actual_to_string is to_hstring [ActualType return string]; -- VHDL-2008 + + -- ScoreboardReportType is deprecated + -- Replaced by Affirmations. ERROR is the default. ALL turns on PASSED flag + type ScoreboardReportType is (REPORT_ERROR, REPORT_ALL, REPORT_NONE) ; -- replaced by affirmations + + type ScoreBoardPType is protected + + ------------------------------------------------------------ + ------------------------------------------------------------ + -- Push items into the scoreboard/FIFO + + -- Simple Scoreboard, no tag + procedure Push (Item : in ExpectedType) ; + + end protected ScoreBoardPType ; + +end ScoreboardGenericPkg ; + + +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +package body ScoreboardGenericPkg is + + type ScoreBoardPType is protected body + + ------------------------------------------------------------ + -- Simple Scoreboard, no tag + procedure Push (Item : in ExpectedType) is + ------------------------------------------------------------ + begin + null; + end procedure Push ; + + end protected body ScoreBoardPType ; +end ScoreboardGenericPkg ; diff --git a/testsuite/gna/issue202/repro.vhdl b/testsuite/gna/issue202/repro.vhdl new file mode 100644 index 000000000..2f2e532f5 --- /dev/null +++ b/testsuite/gna/issue202/repro.vhdl @@ -0,0 +1,48 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library OSVVM; + +entity e is +end entity; + +architecture a of e is + subtype T_DATA is std_logic_vector(31 downto 0); + type T_DATA_VECTOR is array(natural range <>) of T_DATA; + + type T_SCOREBOARD_DATA is record + IsKey : std_logic; + Meta : std_logic_vector(31 downto 0); + Data : T_DATA_VECTOR(15 downto 0); + end record; + + function match(expected : T_SCOREBOARD_DATA; actual : T_SCOREBOARD_DATA) return boolean is + begin + return TRUE; + end function; + + function to_string(vector : T_SCOREBOARD_DATA) return string is + begin + return "to_string"; + end function; + + package P_Scoreboard is new OSVVM.ScoreboardGenericPkg + generic map ( + ExpectedType => T_SCOREBOARD_DATA, + ActualType => T_SCOREBOARD_DATA, + Match => match, + expected_to_string => to_string, + actual_to_string => to_string + ); + alias T_SCOREBOARD is P_Scoreboard.ScoreBoardPType + + shared variable ScoreBoard : T_SCOREBOARD; -- this causes the error message +begin + process + variable v : t_scoreboard_data; + begin + ScoreBoard.Push(v); + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue202/testsuite.sh b/testsuite/gna/issue202/testsuite.sh new file mode 100755 index 000000000..4d6404f90 --- /dev/null +++ b/testsuite/gna/issue202/testsuite.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze --work=osvvm ScoreboardGenericPkg.vhd + +analyze repro.vhdl +elab_simulate e + +clean +clean osvvm + +echo "Test successful" |