-
Notifications
You must be signed in to change notification settings - Fork 1
/
cosim_jtag_fli.vhd
47 lines (44 loc) · 1.87 KB
/
cosim_jtag_fli.vhd
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
-- =============================================================================
-- File: cosim_jtag_fli.vhdl
--
-- Package: cosim_jtag_pkg
--
-- Description: ModelSim / QuestaSim specific implementation of
-- foreign interface from VHDL to C. Utilizes the
-- proprietary Model Technology Incorporated (MIT)
-- Foreign Language Interface (FLI). It behaves almost
-- identical to GHDL implementation of non-compliant
-- VHPIDIRECT if used on procedures. The only
-- difference is the value of the "foreign" attribute.
--
-- Author: Niklaus Leuenberger <@NikLeberg>
--
-- SPDX-License-Identifier: MIT
--
-- Version: 0.1
--
-- Changes: 0.1, 2024-09-17, NikLeberg
-- initial version
-- =============================================================================
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
PACKAGE cosim_jtag_pkg IS
-- Exchange values between VHDL and C.
PROCEDURE tick (
tdo : IN STD_ULOGIC; -- current value of tdo
tck, tms, tdi, trst, srst : OUT STD_ULOGIC
);
-- ModelSim/QuestaSim specific way of declaring foreign MTI FLI C-function:
-- -> "<c_function> <shared_library>"
ATTRIBUTE foreign OF tick : PROCEDURE IS "cosim_jtag_tick ./cosim_jtag.so";
END PACKAGE;
PACKAGE BODY cosim_jtag_pkg IS
PROCEDURE tick (
tdo : IN STD_ULOGIC; -- current value of tdo
tck, tms, tdi, trst, srst : OUT STD_ULOGIC
) IS
BEGIN
-- dummy implementation, gets overwritten by C function cosim_jtag_tick
REPORT "ERROR: foreign subprogram cosim_jtag_tick not called" SEVERITY failure;
END;
END PACKAGE BODY;