#
# Authors: Gabe Black

from __future__ import print_function

import argparse
import m5
import os
import re
import sys

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

parser = argparse.ArgumentParser()
parser.add_argument('--working-dir')

args = parser.parse_args()
if args.working_dir:
    os.chdir(args.working_dir)

kernel.sc_main()

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()
Ejemplo n.º 2
0
import argparse
import m5
import sys

from m5.objects import SystemC_Kernel, Root, SystemC_Printer, Gem5_Feeder

# pylint:disable=unused-variable

parser = argparse.ArgumentParser()
parser.add_argument('--word', action="append", default=[])
parser.add_argument('--delay', default='1ns')
parser.add_argument('--prefix', default='')

args = parser.parse_args()

printer = SystemC_Printer()
printer.prefix = args.prefix

feeder = Gem5_Feeder()
feeder.printer = printer
feeder.delay = args.delay
feeder.strings = args.word

kernel = SystemC_Kernel(feeder=feeder)
root = Root(full_system=True, systemc_kernel=kernel)

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()
print(cause)
Ejemplo n.º 3
0
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Gabe Black

import argparse
import m5
import sys

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

# The python version of the systemc kernel acts as an interface to sc_main. The
# c++ version of the kernel object has a lot of important jobs supporting
# systemc objects and needs to exist in simulations using systemc.
kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

parser = argparse.ArgumentParser()
parser.add_argument(
    '--word',
    action="append",
    default=[],
    help='Add a word to the list of words to print. Can be repeated.')

args = parser.parse_args()

# Tell gem5 to run the c++ sc_main function. If one isn't defined, gem5 will
# detect that and report an error. If gem5 isn't finding your sc_main, make
# sure its signature matches exactly so your compiler doesn't think it's a
# different function.
Ejemplo n.º 4
0
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Gabe Black

import argparse
import m5
import sys

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

# The python version of the systemc kernel acts as an interface to sc_main. The
# c++ version of the kernel object has a lot of important jobs supporting
# systemc objects and needs to exist in simulations using systemc.
kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

parser = argparse.ArgumentParser()
parser.add_argument(
    '--word',
    action="append",
    default=[],
    help='Add a word to the list of words to print. Can be repeated.')

args = parser.parse_args()

# Tell gem5 to run the c++ sc_main function. If one isn't defined, gem5 will
# detect that and report an error. If gem5 isn't finding your sc_main, make
# sure its signature matches exactly so your compiler doesn't think it's a
# different function.
Ejemplo n.º 5
0
#
# Authors: Gabe Black

from __future__ import print_function

import argparse
import m5
import os
import re
import sys

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

parser = argparse.ArgumentParser()
parser.add_argument('--working-dir')

args = parser.parse_args()
if args.working_dir:
    os.chdir(args.working_dir)

kernel.sc_main('gem5_systemc_test')

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()
Ejemplo n.º 6
0
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Gabe Black

from __future__ import print_function

import logging

import m5

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

kernel.sc_main("Hello", "World")

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()
logging.info('Exiting @ tick %i because %s', m5.curTick(), cause)
Ejemplo n.º 7
0
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Gabe Black

from __future__ import print_function

import argparse
import m5
import os
import re

from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

parser = argparse.ArgumentParser()
parser.add_argument('--working-dir')

args = parser.parse_args()
if args.working_dir:
    os.chdir(args.working_dir)

kernel.sc_main("Hello", "World");

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()
Ejemplo n.º 8
0
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Gabe Black

from __future__ import print_function

import sys

import m5
from m5.objects import SystemC_Kernel, Root

# pylint:disable=unused-variable

kernel = SystemC_Kernel()
root = Root(full_system=True, systemc_kernel=kernel)

kernel.sc_main(*sys.argv)

m5.instantiate(None)

cause = m5.simulate(m5.MaxTick).getCause()

result = kernel.sc_main_result()
if result.code != 0:
    m5.util.panic('sc_main return code was %d.' % result.code)