1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include "systemc/ext/channel/messages.hh"
31#include "systemc/utils/report.hh"
32
33namespace sc_core
34{
35
36const char SC_ID_PORT_OUTSIDE_MODULE_[] = "port specified outside of module";
37const char SC_ID_CLOCK_PERIOD_ZERO_[] = "sc_clock period is zero";
38const char SC_ID_CLOCK_HIGH_TIME_ZERO_[] = "sc_clock high time is zero";
39const char SC_ID_CLOCK_LOW_TIME_ZERO_[] = "sc_clock low time is zero";
40const char SC_ID_MORE_THAN_ONE_FIFO_READER_[] =
41    "sc_fifo<T> cannot have more than one reader";
42const char SC_ID_MORE_THAN_ONE_FIFO_WRITER_[] =
43    "sc_fifo<T> cannot have more than one writer";
44const char SC_ID_INVALID_FIFO_SIZE_[] =
45    "sc_fifo<T> must have a size of at least 1";
46const char SC_ID_BIND_IF_TO_PORT_[] = "bind interface to port failed";
47const char SC_ID_BIND_PORT_TO_PORT_[] = "bind parent port to port failed";
48const char SC_ID_COMPLETE_BINDING_[] = "complete binding failed";
49const char SC_ID_INSERT_PORT_[] = "insert port failed";
50const char SC_ID_REMOVE_PORT_[] = "remove port failed";
51const char SC_ID_GET_IF_[] = "get interface failed";
52const char SC_ID_INSERT_PRIM_CHANNEL_[] = "insert primitive channel failed";
53const char SC_ID_REMOVE_PRIM_CHANNEL_[] = "remove primitive channel failed";
54const char SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_[] =
55    "sc_signal<T> cannot have more than one driver";
56const char SC_ID_NO_DEFAULT_EVENT_[] = "channel doesn't have a default event";
57const char SC_ID_RESOLVED_PORT_NOT_BOUND_[] =
58    "resolved port not bound to resolved signal";
59const char SC_ID_FIND_EVENT_[] = "find event failed";
60const char SC_ID_INVALID_SEMAPHORE_VALUE_[] =
61    "sc_semaphore requires an initial value >= 0";
62const char SC_ID_SC_EXPORT_HAS_NO_INTERFACE_[] =
63    "sc_export instance has no interface";
64const char SC_ID_INSERT_EXPORT_[] = "insert sc_export failed";
65const char SC_ID_EXPORT_OUTSIDE_MODULE_[] =
66    "sc_export specified outside of module";
67const char SC_ID_SC_EXPORT_NOT_REGISTERED_[] =
68    "remove sc_export failed, sc_export not registered";
69const char SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_[] =
70    "sc_export instance not bound to interface at end of construction";
71const char SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_[] =
72    "attempt to write the value of an sc_clock instance";
73const char SC_ID_SC_EXPORT_ALREADY_BOUND_[] =
74    "sc_export instance already bound";
75const char SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_[] =
76    "attempted specalized signal operation on non-specialized signal";
77const char SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_[] =
78    "attempted to bind sc_clock instance to sc_inout or sc_out";
79const char SC_ID_NO_ASYNC_UPDATE_[] =
80    "this build has no asynchronous update support";
81
82namespace
83{
84
85sc_gem5::DefaultReportMessages predefinedMessages{
86    {100, SC_ID_PORT_OUTSIDE_MODULE_},
87    {101, SC_ID_CLOCK_PERIOD_ZERO_},
88    {102, SC_ID_CLOCK_HIGH_TIME_ZERO_},
89    {103, SC_ID_CLOCK_LOW_TIME_ZERO_},
90    {104, SC_ID_MORE_THAN_ONE_FIFO_READER_},
91    {105, SC_ID_MORE_THAN_ONE_FIFO_WRITER_},
92    {106, SC_ID_INVALID_FIFO_SIZE_},
93    {107, SC_ID_BIND_IF_TO_PORT_},
94    {108, SC_ID_BIND_PORT_TO_PORT_},
95    {109, SC_ID_COMPLETE_BINDING_},
96    {110, SC_ID_INSERT_PORT_},
97    {111, SC_ID_REMOVE_PORT_},
98    {112, SC_ID_GET_IF_},
99    {113, SC_ID_INSERT_PRIM_CHANNEL_},
100    {114, SC_ID_REMOVE_PRIM_CHANNEL_},
101    {115, SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_},
102    {116, SC_ID_NO_DEFAULT_EVENT_},
103    {117, SC_ID_RESOLVED_PORT_NOT_BOUND_},
104    {118, SC_ID_FIND_EVENT_},
105    {119, SC_ID_INVALID_SEMAPHORE_VALUE_},
106    {120, SC_ID_SC_EXPORT_HAS_NO_INTERFACE_},
107    {121, SC_ID_INSERT_EXPORT_},
108    {122, SC_ID_EXPORT_OUTSIDE_MODULE_},
109    {123, SC_ID_SC_EXPORT_NOT_REGISTERED_},
110    {124, SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_},
111    {125, SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_},
112    {126, SC_ID_SC_EXPORT_ALREADY_BOUND_},
113    {127, SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_},
114    {128, SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_},
115    {129, SC_ID_NO_ASYNC_UPDATE_}
116};
117
118} // anonymous namespace
119
120} // namespace sc_core
121