w11 - vhd
0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
rlink_cext_iface_vhpi.vhd
Go to the documentation of this file.
1
-- $Id: rlink_cext_iface_vhpi.vhd 1181 2019-07-08 17:00:50Z mueller $
2
-- SPDX-License-Identifier: GPL-3.0-or-later
3
-- Copyright 2016- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
------------------------------------------------------------------------------
6
-- Module Name: rlink_cext_iface - sim
7
-- Description: Interface to external C code for tbcore_rlink - VHPI version
8
--
9
-- Dependencies: -
10
--
11
-- To test: -
12
--
13
-- Target Devices: generic
14
-- Tool versions: ghdl 0.31
15
-- Revision History:
16
-- Date Rev Version Comment
17
-- 2016-02-07 729 1.0 Initial version
18
------------------------------------------------------------------------------
19
20
library
ieee
;
21
use
ieee.std_logic_1164.
all
;
22
use
ieee.numeric_std.
all
;
23
use
ieee.std_logic_textio.
all
;
24
use
std.textio.
all
;
25
26
use
work.
slvtypes
.
all
;
27
use
work.
rlink_cext_vhpi
.
all
;
28
29
entity
rlink_cext_iface
is
-- interface to external C code - VHPI
30
port
(
31
CLK
:
in
slbit
;
-- clock
32
CLK_CYCLE
:
in
slv32
;
-- clock cycle number
33
RX_DATA
:
out
slv32
;
-- read data (data ext->tb)
34
RX_VAL
:
out
slbit
;
-- read data valid (data ext->tb)
35
RX_HOLD
:
in
slbit
;
-- read data hold (data ext->tb)
36
TX_DATA
:
in
slv8
;
-- write data (data tb->ext)
37
TX_ENA
:
in
slbit
-- write data enable (data tb->ext)
38
)
;
39
end
rlink_cext_iface
;
40
41
architecture
sim
of
rlink_cext_iface
is
42
signal
R_RXDATA
:
slv32
:=
(
others
=
>
'
1
'
)
;
43
signal
R_RXVAL
:
slbit
:=
'
0
'
;
44
begin
45
46
proc_put:
process
(
CLK
)
47
variable
itxrc
:
integer
:=
0
;
48
begin
49
if
rising_edge
(
CLK
)
then
50
if
TX_ENA
=
'
1
'
then
51
itxrc
:=
rlink_cext_putbyte
(
to_integer
(
unsigned
(
TX_DATA
)
)
)
;
52
assert
itxrc
=
0
53
report
"rlink_cext_putbyte error: "
&
integer
'
image
(
itxrc
)
54
severity
failure
;
55
end
if
;
56
57
end
if
;
58
59
end
process
proc_put
;
60
61
proc_get:
process
(
CLK
)
62
variable
irxint
:
integer
:=
0
;
63
begin
64
if
rising_edge
(
CLK
)
then
65
if
RX_HOLD
=
'
0
'
or
R_RXVAL
=
'
0
'
then
66
irxint
:=
rlink_cext_getbyte
(
to_integer
(
signed
(
CLK_CYCLE
)
)
)
;
67
R_RXDATA
<=
slv
(
to_signed
(
irxint
,
32
)
)
;
68
if
irxint
>=
0
then
69
R_RXVAL
<=
'
1
'
;
70
else
71
R_RXVAL
<=
'
0
'
;
72
end
if
;
73
end
if
;
74
end
if
;
75
76
end
process
proc_get
;
77
78
RX_DATA
<=
R_RXDATA
;
79
RX_VAL
<=
R_RXVAL
;
80
81
end
sim;
rlink_cext_iface.sim
Definition:
rlink_cext_iface_vhpi.vhd:41
rlink_cext_iface.sim.R_RXVAL
slbit := '0' R_RXVAL
Definition:
rlink_cext_iface_vhpi.vhd:43
rlink_cext_iface.sim.R_RXDATA
slv32 :=( others => '1') R_RXDATA
Definition:
rlink_cext_iface_vhpi.vhd:42
rlink_cext_iface
Definition:
rlink_cext_iface_vhpi.vhd:29
rlink_cext_iface.RX_HOLD
in RX_HOLD slbit
Definition:
rlink_cext_iface_vhpi.vhd:35
rlink_cext_iface.CLK
in CLK slbit
Definition:
rlink_cext_iface_vhpi.vhd:31
rlink_cext_iface.TX_ENA
in TX_ENA slbit
Definition:
rlink_cext_iface_vhpi.vhd:38
rlink_cext_iface.RX_DATA
out RX_DATA slv32
Definition:
rlink_cext_iface_vhpi.vhd:33
rlink_cext_iface.CLK_CYCLE
in CLK_CYCLE slv32
Definition:
rlink_cext_iface_vhpi.vhd:32
rlink_cext_iface.TX_DATA
in TX_DATA slv8
Definition:
rlink_cext_iface_vhpi.vhd:36
rlink_cext_iface.RX_VAL
out RX_VAL slbit
Definition:
rlink_cext_iface_vhpi.vhd:34
rlink_cext_vhpi
Definition:
rlink_cext_vhpi.vhd:17
slvtypes
Definition:
slvtypes.vhd:28
slvtypes.slv32
std_logic_vector( 31 downto 0) slv32
Definition:
slvtypes.vhd:59
slvtypes.slbit
std_logic slbit
Definition:
slvtypes.vhd:30
slvtypes.slv8
std_logic_vector( 7 downto 0) slv8
Definition:
slvtypes.vhd:40
slvtypes.slv
std_logic_vector slv
Definition:
slvtypes.vhd:31
vlib
rlink
tbcore
rlink_cext_iface_vhpi.vhd
Generated on Thu Feb 9 2023 12:41:06 for w11 - vhd by
1.9.6