Skip to content

Commit 0eb9cc5

Browse files
committed
Add InterruptGenerator
1 parent 0906346 commit 0eb9cc5

8 files changed

+471
-25
lines changed

Common.pro

+1-14
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,4 @@
3939
# limitations under the License.
4040
#
4141
library OSVVM_Common
42-
ChangeWorkingDirectory ./src
43-
analyze ModelParametersPkg.vhd
44-
analyze FifoFillPkg_slv.vhd
45-
analyze StreamTransactionPkg.vhd
46-
analyze StreamTransactionArrayPkg.vhd
47-
analyze AddressBusTransactionPkg.vhd
48-
analyze AddressBusTransactionArrayPkg.vhd
49-
analyze AddressBusResponderTransactionPkg.vhd
50-
analyze AddressBusResponderTransactionArrayPkg.vhd
51-
analyze AddressBusVersionCompatibilityPkg.vhd
52-
analyze InterruptGlobalSignalPkg.vhd
53-
analyze InterruptHandler.vhd
54-
analyze InterruptHandlerComponentPkg.vhd
55-
analyze OsvvmCommonContext.vhd
42+
include src/Common.pro

src/.gitignore

-1
This file was deleted.

src/Common.pro

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# File Name: common.pro
2+
# Revision: OSVVM MODELS STANDARD VERSION
3+
#
4+
# Maintainer: Jim Lewis email: [email protected]
5+
# Contributor(s):
6+
# Jim Lewis [email protected]
7+
#
8+
#
9+
# Description:
10+
# Top level script to compile the OSVVM common packages
11+
#
12+
# Developed for:
13+
# SynthWorks Design Inc.
14+
# VHDL Training Classes
15+
# 11898 SW 128th Ave. Tigard, Or 97223
16+
# http://www.SynthWorks.com
17+
#
18+
# Revision History:
19+
# Date Version Description
20+
# 11/2022 2022.11 Added AddressBusTransactionArrayPkg and AddressBusResponderTransactionArrayPkg
21+
# 1/2020 2020.01 Updated Licenses to Apache
22+
# 1/2019 2019.01 Compile Script for OSVVM Common library
23+
#
24+
#
25+
# This file is part of OSVVM.
26+
#
27+
# Copyright (c) 2019 - 2020 by SynthWorks Design Inc.
28+
#
29+
# Licensed under the Apache License, Version 2.0 (the "License");
30+
# you may not use this file except in compliance with the License.
31+
# You may obtain a copy of the License at
32+
#
33+
# https://www.apache.org/licenses/LICENSE-2.0
34+
#
35+
# Unless required by applicable law or agreed to in writing, software
36+
# distributed under the License is distributed on an "AS IS" BASIS,
37+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38+
# See the License for the specific language governing permissions and
39+
# limitations under the License.
40+
#
41+
library OSVVM_Common
42+
analyze ModelParametersPkg.vhd
43+
analyze FifoFillPkg_slv.vhd
44+
45+
# MIT
46+
analyze StreamTransactionPkg.vhd
47+
analyze StreamTransactionArrayPkg.vhd
48+
analyze AddressBusTransactionPkg.vhd
49+
analyze AddressBusTransactionArrayPkg.vhd
50+
analyze AddressBusResponderTransactionPkg.vhd
51+
analyze AddressBusResponderTransactionArrayPkg.vhd
52+
analyze AddressBusVersionCompatibilityPkg.vhd
53+
54+
# Interrupt
55+
analyze InterruptGlobalSignalPkg.vhd
56+
analyze InterruptHandler.vhd
57+
analyze InterruptHandlerComponentPkg.vhd
58+
analyze InterruptGeneratorBit.vhd
59+
analyze InterruptGeneratorBitVti.vhd
60+
# analyze InterruptGenerator.vhd
61+
# analyze InterruptGeneratorVti.vhd
62+
analyze InterruptGeneratorComponentPkg.vhd
63+
64+
analyze OsvvmCommonContext.vhd

src/InterruptGeneratorBit.vhd

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
--
2+
-- File Name: InterruptGeneratorBit.vhd
3+
-- Design Unit Name: InterruptGeneratorBit
4+
-- Revision: OSVVM MODELS STANDARD VERSION
5+
--
6+
-- Maintainer: Jim Lewis email: [email protected]
7+
-- Contributor(s):
8+
-- Jim Lewis [email protected]
9+
--
10+
--
11+
-- Description:
12+
-- InterruptGeneratorBit
13+
--
14+
--
15+
-- Developed by:
16+
-- SynthWorks Design Inc.
17+
-- VHDL Training Classes
18+
-- http://www.SynthWorks.com
19+
--
20+
-- Revision History:
21+
-- Date Version Description
22+
-- 01/2023 2023.01 Initial revision
23+
--
24+
--
25+
-- This file is part of OSVVM.
26+
--
27+
-- Copyright (c) 2023 by SynthWorks Design Inc.
28+
--
29+
-- Licensed under the Apache License, Version 2.0 (the "License");
30+
-- you may not use this file except in compliance with the License.
31+
-- You may obtain a copy of the License at
32+
--
33+
-- https://www.apache.org/licenses/LICENSE-2.0
34+
--
35+
-- Unless required by applicable law or agreed to in writing, software
36+
-- distributed under the License is distributed on an "AS IS" BASIS,
37+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38+
-- See the License for the specific language governing permissions and
39+
-- limitations under the License.
40+
--
41+
library ieee ;
42+
use ieee.std_logic_1164.all ;
43+
use ieee.numeric_std.all ;
44+
use ieee.numeric_std_unsigned.all ;
45+
use ieee.math_real.all ;
46+
47+
library osvvm ;
48+
context osvvm.OsvvmContext ;
49+
use osvvm.ScoreboardPkg_slv.all ;
50+
51+
use work.StreamTransactionPkg.all;
52+
use work.InterruptGlobalSignalPkg.all ;
53+
54+
55+
entity InterruptGeneratorBit is
56+
generic (
57+
MODEL_ID_NAME : string := "" ;
58+
POLARITY : std_logic := '1'
59+
) ;
60+
port (
61+
-- Interrupt Input
62+
IntReq : out std_logic ;
63+
64+
-- Transaction port
65+
TransRec : inout InterruptGeneratorBitRecType
66+
) ;
67+
68+
end entity InterruptGeneratorBit ;
69+
architecture Behavioral of InterruptGeneratorBit is
70+
constant MODEL_INSTANCE_NAME : string :=
71+
-- use MODEL_ID_NAME Generic if set, otherwise use instance label (preferred if set as entityname_1)
72+
IfElse(MODEL_ID_NAME /= "", MODEL_ID_NAME, to_lower(PathTail(InterruptGeneratorBit'PATH_NAME))) ;
73+
74+
signal ModelID : AlertLogIDType ;
75+
76+
begin
77+
78+
------------------------------------------------------------
79+
-- Initialize alerts
80+
------------------------------------------------------------
81+
Initialize : process
82+
variable ID : AlertLogIDType ;
83+
begin
84+
-- Alerts
85+
ID := NewID(MODEL_INSTANCE_NAME) ;
86+
ModelID <= ID ;
87+
wait ;
88+
end process Initialize ;
89+
90+
91+
------------------------------------------------------------
92+
-- Transaction Handler
93+
-- Decodes Transactions and Handlers DUT Interface
94+
------------------------------------------------------------
95+
TransactionHandler : process
96+
alias Operation : StreamOperationType is TransRec.Operation ;
97+
begin
98+
-- Initialize Outputs
99+
IntReq <= not POLARITY ;
100+
TransRec.DataFromModel <= (others => '0') ;
101+
102+
wait for 0 ns ;
103+
104+
TransactionDispatcherLoop : loop
105+
WaitForTransaction(
106+
Rdy => TransRec.Rdy,
107+
Ack => TransRec.Ack
108+
) ;
109+
110+
case Operation is
111+
when SEND | SEND_ASYNC =>
112+
IntReq <= TransRec.DataToModel(0) ;
113+
114+
when GET | TRY_GET =>
115+
TransRec.DataFromModel(0) <= IntReq ;
116+
117+
when WAIT_FOR_TRANSACTION =>
118+
wait for 0 ns ;
119+
120+
when WAIT_FOR_CLOCK =>
121+
Alert(ModelID, "No clocks in this VC. Not waiting.") ;
122+
123+
when GET_ALERTLOG_ID =>
124+
TransRec.IntFromModel <= ModelID ;
125+
126+
when GET_TRANSACTION_COUNT =>
127+
TransRec.IntFromModel <= TransRec.Rdy ;
128+
129+
when MULTIPLE_DRIVER_DETECT =>
130+
Alert(ModelID, "Multiple Drivers on Transaction Record." &
131+
" Transaction # " & to_string(TransRec.Rdy), FAILURE) ;
132+
133+
when others =>
134+
Alert(ModelID, "Unimplemented Transaction: " & to_string(Operation), FAILURE) ;
135+
136+
end case ;
137+
end loop TransactionDispatcherLoop ;
138+
end process TransactionHandler ;
139+
140+
end architecture Behavioral ;

src/InterruptGeneratorBitVti.vhd

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
--
2+
-- File Name: InterruptGeneratorBit.vhd
3+
-- Design Unit Name: InterruptGeneratorBit
4+
-- Revision: OSVVM MODELS STANDARD VERSION
5+
--
6+
-- Maintainer: Jim Lewis email: [email protected]
7+
-- Contributor(s):
8+
-- Jim Lewis [email protected]
9+
--
10+
--
11+
-- Description:
12+
-- InterruptGeneratorBit
13+
--
14+
--
15+
-- Developed by:
16+
-- SynthWorks Design Inc.
17+
-- VHDL Training Classes
18+
-- http://www.SynthWorks.com
19+
--
20+
-- Revision History:
21+
-- Date Version Description
22+
-- 01/2023 2023.01 Initial revision
23+
--
24+
--
25+
-- This file is part of OSVVM.
26+
--
27+
-- Copyright (c) 2023 by SynthWorks Design Inc.
28+
--
29+
-- Licensed under the Apache License, Version 2.0 (the "License");
30+
-- you may not use this file except in compliance with the License.
31+
-- You may obtain a copy of the License at
32+
--
33+
-- https://www.apache.org/licenses/LICENSE-2.0
34+
--
35+
-- Unless required by applicable law or agreed to in writing, software
36+
-- distributed under the License is distributed on an "AS IS" BASIS,
37+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38+
-- See the License for the specific language governing permissions and
39+
-- limitations under the License.
40+
--
41+
library ieee ;
42+
use ieee.std_logic_1164.all ;
43+
use ieee.numeric_std.all ;
44+
use ieee.numeric_std_unsigned.all ;
45+
use ieee.math_real.all ;
46+
47+
library osvvm ;
48+
context osvvm.OsvvmContext ;
49+
use osvvm.ScoreboardPkg_slv.all ;
50+
51+
use work.StreamTransactionPkg.all;
52+
use work.InterruptGlobalSignalPkg.all ;
53+
54+
55+
entity InterruptGeneratorBit is
56+
generic (
57+
MODEL_ID_NAME : string := "" ;
58+
POLARITY : std_logic := '1'
59+
) ;
60+
port (
61+
-- Interrupt Input
62+
IntReq : out std_logic
63+
) ;
64+
65+
-- Connects to sequencer (TestCtrl)
66+
signal TransRec : StreamRecType(DataToModel(0 downto 0), DataFromModel(0 downto 0), ParamToModel(1 to 0), ParamFromModel(1 to 0)) ;
67+
68+
end entity InterruptGeneratorBit ;
69+
architecture Behavioral of InterruptGeneratorBit is
70+
constant MODEL_INSTANCE_NAME : string :=
71+
-- use MODEL_ID_NAME Generic if set, otherwise use instance label (preferred if set as entityname_1)
72+
IfElse(MODEL_ID_NAME /= "", MODEL_ID_NAME, to_lower(PathTail(InterruptGeneratorBit'PATH_NAME))) ;
73+
74+
signal ModelID : AlertLogIDType ;
75+
76+
begin
77+
78+
------------------------------------------------------------
79+
-- Initialize alerts
80+
------------------------------------------------------------
81+
Initialize : process
82+
variable ID : AlertLogIDType ;
83+
begin
84+
-- Alerts
85+
ID := NewID(MODEL_INSTANCE_NAME) ;
86+
ModelID <= ID ;
87+
wait ;
88+
end process Initialize ;
89+
90+
91+
------------------------------------------------------------
92+
-- Transaction Handler
93+
-- Decodes Transactions and Handlers DUT Interface
94+
------------------------------------------------------------
95+
TransactionHandler : process
96+
alias Operation : StreamOperationType is TransRec.Operation ;
97+
variable Data : std_logic_vector(gIntReq'range) ;
98+
begin
99+
-- Initialize Outputs
100+
IntReq <= not POLARITY ;
101+
TransRec.DataFromModel <= (others => '0') ;
102+
103+
wait for 0 ns ;
104+
105+
TransactionDispatcherLoop : loop
106+
WaitForTransaction(
107+
Rdy => TransRec.Rdy,
108+
Ack => TransRec.Ack
109+
) ;
110+
111+
case Operation is
112+
when SEND | SEND_ASYNC =>
113+
IntReq <= TransRec.DataToModel(0) ;
114+
115+
when GET | TRY_GET =>
116+
TransRec.DataFromModel(0) <= IntReq ;
117+
118+
when WAIT_FOR_TRANSACTION =>
119+
wait for 0 ns ;
120+
121+
when WAIT_FOR_CLOCK =>
122+
Alert(ModelID, "No clocks in this VC. Not waiting.") ;
123+
124+
when GET_ALERTLOG_ID =>
125+
TransRec.IntFromModel <= ModelID ;
126+
127+
when GET_TRANSACTION_COUNT =>
128+
TransRec.IntFromModel <= TransRec.Rdy ;
129+
130+
when MULTIPLE_DRIVER_DETECT =>
131+
Alert(ModelID, "Multiple Drivers on Transaction Record." &
132+
" Transaction # " & to_string(TransRec.Rdy), FAILURE) ;
133+
134+
when others =>
135+
Alert(ModelID, "Unimplemented Transaction: " & to_string(Operation), FAILURE) ;
136+
137+
end case ;
138+
end loop TransactionDispatcherLoop ;
139+
end process TransactionHandler ;
140+
141+
end architecture Behavioral ;

0 commit comments

Comments
 (0)