OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
iGen generator code for 'manycore24' SystemC TlM2.0 Model

 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Getting Started
View previous topic :: View next topic  
Author Message
KyleMcgrath



Joined: 31 Mar 2017
Posts: 2

PostPosted: Wed Jun 14, 2017 6:19 am    Post subject: iGen generator code for 'manycore24' SystemC TlM2.0 Model Reply with quote

Hello,

I was looking through the package OVPsim_demo_tlm2.0 provided under OSCI SystemC TLM2.0 Models, and the example "manycore24" had a system very similar to what I need for my project. I would like to dynamically change the amount of cores, and potentially processors used with this example. This example was generated with iGen, yet I was unable to find the .tcl file to recreate it.

I was wondering if I could be provided with this code?

Secondly, I when generating my own code that the sc_main function was never filled out. Is there a way that I can configure iGen so it loads the application on each processor in the code like manycore24 does? Or is it necessary for me to specify this myself?

Thanks.
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1581
Location: United Kingdom

PostPosted: Wed Jun 14, 2017 7:13 am    Post subject: Reply with quote

I would create a module, in the normal way, that instances the sub-systems required. For example module.op.tcl would be

Code:
ihwnew -name BareMetal -vendor test.ovpworld.org -library module -version 1.0 -stoponctrlc -releasestatus ovp -visibility visible -purpose module

for {set instance 0} {$instance < 24} {incr instance} {

    #
    # main bus
    #
    ihwaddbus -instancename bus${instance} -addresswidth 32

    #
    # main processor
    #
    ihwaddprocessor -instancename cpu${instance} \
          -type arm -library processor -vendor arm.ovpworld.org \
          -semihostvendor arm.ovpworld.org -semihostname armNewlib \
          -mips 100.0

    #
    # processor (default) attributes
    #
    ihwsetparameter -handle cpu${instance} -name variant -value Cortex-A9MPx1 -type enum

    #
    # Connect processor to bus
    #
    ihwconnect -bus bus${instance} -instancename cpu${instance} -busmasterport INSTRUCTION
    ihwconnect -bus bus${instance} -instancename cpu${instance} -busmasterport DATA

    #
    # Memory 0x00000000 to 0xffffffff
    # (this may be un-realistic and memory should be provided in correct locations)
    #
    ihwaddmemory -instancename mem${instance}_0 -type ram
    ihwconnect   -instancename mem${instance}_0 -bus bus${instance} -busslaveport sp1 -loaddress 0x00000000 -hiaddress 0x1fffffff

    ihwaddmemory -instancename mem${instance}_1 -type ram
    ihwconnect   -instancename mem${instance}_1 -bus bus${instance} -busslaveport sp1 -loaddress 0x20000000 -hiaddress 0xffffffff

}


I would then create another file platform.tml.tcl file that loads this and adds the Command Line Parser
Code:

# load design defined in module
puts "# Loading module.op.tcl"
source module.op.tcl

# add command line parser
ihwaddclp -allargs


This platform.tlm.tcl can be built with a combination of a common Makefile and some additional targets

Code:
# Default to local build
NOVLNV?=1

USERHEADER?=$(IMPERAS_HOME)/ImperasLib/fileheaders/refESLA.txt
include $(IMPERAS_HOME)/ImperasLib/buildutils/Makefile.common

#
# generate all iGen source
#
IGEN?= igen.exe
DEPENDS?=
IGENFLAGS?=--quiet --nobanner --excludem GPT_NH --excludem GPT_UFNR

all: platform.$(IMPERAS_ARCH).exe

platform-igen-ext      = platform.cpp \
                         platform.sc_clp.igen.h \
                         platform.sc_constructor.igen.h \
                         platform.sc_options.igen.h

platform.tlm.tcl : module.op.tcl
   @ touch $@

$(platform-igen-ext) : platform.tlm.tcl
   @ echo "# iGen Generate Platform files"
   $(V) $(IGEN) --batch $^ --writetlm $@ \
        $(WRITEHEADER) $(IGENFLAGS)       \
        --overwrite --op --output igen.log

platform.$(IMPERAS_ARCH).exe : $(platform-igen-ext)
   @ echo "# Build $@"
   $(V) $(MAKE) -f $(IMPERAS_HOME)/ImperasLib/buildutils/Makefile.TLM.platform \
                        NOVLNV=1 SRC=platform.cpp OPTLM=1

clean:
   $(V) $(MAKE) -f $(IMPERAS_HOME)/ImperasLib/buildutils/Makefile.TLM.platform \
                        NOVLNV=1 SRC=platform.cpp OPTLM=1 clean
   $(V) rm -f *.igen.*

realclean: clean
   $(V) $(MAKE) -f $(IMPERAS_HOME)/ImperasLib/buildutils/Makefile.TLM.platform \
                        NOVLNV=1 SRC=platform.cpp OPTLM=1 realclean
   $(V) rm -f platform.cpp *.log


that will build a SystemC executable that you can then run with

Code:
platform.${IMPERAS_ARCH}.exe \
    --program application/app.ARM_CORTEX_A9.elf \
    --output platformTLM.log \
    --verbose


Note that I am NOT adding the loading of the application into the hardware definition. This should only be done when there is some resident software that is always loaded otherwise it make using the virtual platform inflexible.
By using --program and specifying the application this program is loaded onto ALL the processors, if we want to load different applications onto processors we can specify the processor to load, e.g. --program <platform>/<processor>=app.elf
Back to top
View user's profile Send private message Visit poster's website
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1581
Location: United Kingdom

PostPosted: Wed Jun 14, 2017 7:15 am    Post subject: Reply with quote

You could also just build the module and run this stand-alone without using SystemC

to build the module

Code:
make -f $(IMPERAS_HOME)/ImperasLib/buildutils/Makefile.module NOVLNV=1


and to run with the module

Code:
harness.exe \
    --modulefile module/model.${IMPERAS_SHRSUF} \
    --program  application/app.ARM_CORTEX_A9.elf \
    --output module.log \
    --verbose
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Getting Started All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2020 Imperas Software