|
| 1 | +-- This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +-- License, v. 2.0. If a copy of the MPL was not distributed with this file, |
| 3 | +-- You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 | +-- |
| 5 | +-- Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com |
| 6 | + |
| 7 | +library vunit_lib; |
| 8 | +context vunit_lib.vunit_context; |
| 9 | +context vunit_lib.com_context; |
| 10 | +context vunit_lib.vc_context; |
| 11 | + |
| 12 | +package vc_not_supporting_custom_actor_pkg is |
| 13 | + type vc_not_supporting_custom_actor_handle_t is record |
| 14 | + p_actor : actor_t; |
| 15 | + p_logger : logger_t; |
| 16 | + p_checker : checker_t; |
| 17 | + p_fail_on_unexpected_msg_type : boolean; |
| 18 | + end record; |
| 19 | + |
| 20 | + constant vc_not_supporting_custom_actor_logger : logger_t := get_logger("vc_not_supporting_custom_actor"); |
| 21 | + constant vc_not_supporting_custom_actor_checker : checker_t := new_checker(vc_not_supporting_custom_actor_logger); |
| 22 | + constant vc_not_supporting_custom_actor_actor : actor_t := new_actor("vc_not_supporting_custom_actor_actor"); |
| 23 | + |
| 24 | + constant transaction_msg : msg_type_t := new_msg_type("transaction"); |
| 25 | + |
| 26 | + impure function new_vc_not_supporting_custom_actor( |
| 27 | + logger : logger_t := vc_not_supporting_custom_actor_logger; |
| 28 | + actor : actor_t := null_actor; |
| 29 | + checker : checker_t := null_checker; |
| 30 | + fail_on_unexpected_msg_type : boolean := true |
| 31 | + ) return vc_not_supporting_custom_actor_handle_t; |
| 32 | + |
| 33 | + procedure transaction( |
| 34 | + signal net : inout network_t; |
| 35 | + vc_h : vc_not_supporting_custom_actor_handle_t |
| 36 | + ); |
| 37 | + |
| 38 | + impure function as_sync( |
| 39 | + vc_h : vc_not_supporting_custom_actor_handle_t |
| 40 | + ) return sync_handle_t; |
| 41 | + |
| 42 | +end package; |
| 43 | + |
| 44 | +package body vc_not_supporting_custom_actor_pkg is |
| 45 | + impure function new_vc_not_supporting_custom_actor( |
| 46 | + logger : logger_t := vc_not_supporting_custom_actor_logger; |
| 47 | + actor : actor_t := null_actor; |
| 48 | + checker : checker_t := null_checker; |
| 49 | + fail_on_unexpected_msg_type : boolean := true |
| 50 | + ) return vc_not_supporting_custom_actor_handle_t is |
| 51 | + variable p_actor : actor_t; |
| 52 | + variable p_checker : checker_t; |
| 53 | + begin |
| 54 | + if actor = null_actor then |
| 55 | + p_actor := new_actor; |
| 56 | + else |
| 57 | + p_actor := actor; |
| 58 | + end if; |
| 59 | + |
| 60 | + if checker = null_checker then |
| 61 | + if logger = vc_not_supporting_custom_actor_logger then |
| 62 | + p_checker := vc_not_supporting_custom_actor_checker; |
| 63 | + else |
| 64 | + p_checker := new_checker(logger); |
| 65 | + end if; |
| 66 | + else |
| 67 | + p_checker := checker; |
| 68 | + end if; |
| 69 | + |
| 70 | + return ( |
| 71 | + p_logger => logger, |
| 72 | + p_actor => p_actor, |
| 73 | + p_checker => p_checker, |
| 74 | + p_fail_on_unexpected_msg_type => fail_on_unexpected_msg_type |
| 75 | + ); |
| 76 | + end; |
| 77 | + |
| 78 | + procedure transaction( |
| 79 | + signal net : inout network_t; |
| 80 | + vc_h : vc_not_supporting_custom_actor_handle_t |
| 81 | + ) is |
| 82 | + variable msg : msg_t; |
| 83 | + begin |
| 84 | + msg := new_msg(transaction_msg); |
| 85 | + send(net, vc_not_supporting_custom_actor_actor, msg); |
| 86 | + end procedure; |
| 87 | + |
| 88 | + impure function as_sync( |
| 89 | + vc_h : vc_not_supporting_custom_actor_handle_t |
| 90 | + ) return sync_handle_t is |
| 91 | + begin |
| 92 | + return vc_not_supporting_custom_actor_actor; |
| 93 | + end; |
| 94 | + |
| 95 | +end package body; |
| 96 | + |
0 commit comments