113724Sgabeblack@google.com# Copyright 2019 Google, Inc.
213724Sgabeblack@google.com#
313724Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
413724Sgabeblack@google.com# modification, are permitted provided that the following conditions are
513724Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
613724Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
713724Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
813724Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
913724Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
1013724Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
1113724Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
1213724Sgabeblack@google.com# this software without specific prior written permission.
1313724Sgabeblack@google.com#
1413724Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1513724Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1613724Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1713724Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1813724Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1913724Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2013724Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2113724Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2213724Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2313724Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2413724Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2513724Sgabeblack@google.com#
2613724Sgabeblack@google.com# Authors: Gabe Black
2713724Sgabeblack@google.com
2813724Sgabeblack@google.comimport _m5.systemc
2913724Sgabeblack@google.com
3013724Sgabeblack@google.comfrom _m5.systemc import sc_main
3113724Sgabeblack@google.comfrom _m5.systemc import sc_time
3213724Sgabeblack@google.comfrom _m5.systemc import sc_main_result_code, sc_main_result_str
3313724Sgabeblack@google.com
3413724Sgabeblack@google.comclass ScMainResult(object):
3513724Sgabeblack@google.com    def __init__(self, code, message):
3613724Sgabeblack@google.com        self.code = code
3713724Sgabeblack@google.com        self.message = message
3813724Sgabeblack@google.com
3913724Sgabeblack@google.comdef sc_main_result():
4013724Sgabeblack@google.com    '''Retrieve and return the results of running sc_main'''
4113724Sgabeblack@google.com    return ScMainResult(sc_main_result_code(), sc_main_result_str())
4213724Sgabeblack@google.com
4313724Sgabeblack@google.com__all__ = [ 'sc_main', 'sc_time', 'sc_main_result' ]
44