Lecture 4.txt: EECS 221 in Fall 2006 ==================================== LECTURE TOPIC: Software Synthesis in the SoC Environment (SCE) -------------------------------------------------------------- ABSTRACT: Software synthesis in SCE is performed in a series of refinement steps that take an abstract initial specification model down to a cycle-accurate implementation model that can be simulated by use of an instruction set simulator (ISS). The instructions listed below indicate step-by-step how a simple example design is being synthesized using SCE. The application in this example a set of simple tasks that execute sequentially or in parallel, and communicate by use of a simple one-way handshaking channel. An ARM7TDMI embedded processor is being used as target platform, running micro-OS-2 as real-time operating system (RTOS). To simulate the final implementation model in cycle-accurate fashion, the SWARM (software-ARM) ISS is being used. DETAILED INSTRUCTIONS: (on 'epsilon.eecs.uci.edu') 0) Prepare a clean setup 0.1) Remove any previous .sce file rm -rf ~/.sce 0.2) Prepare a working directory mkdir ISS_DEMO cd ISS_DEMO 0.3) Copy the prepared example files cp /home/doemer/EECS221_F06/swarmExamples.tar.gz . gtar xvzf swarmExamples.tar.gz cd swarmExamples/task/ 1) Source the SCE setup files (use the latest version!) source /opt/sce-20060301/bin/setup.csh 2) Startup the GUI sce & 3) Import your source file File->Import chose: "testBehaviors.sc" 4) Select the top level behavior. Right click on the behavior Design and select from the context menu the option "Set as top level". 5) Create new project. Project->New 6) Add the imported design into the project. Project->Add Design 7) Save the project into a new file. File->Save (Ignore warning about read only). Select a new file name, e.g. "Spec" 8) Allocate the processing elements we want to use throughout the process 8.1) Allocate the ARM processor Synthesis->Allocate PE In the new dialog (named "PE Allocation") select "Add..." A dialog "PE Selection" appears. In there from Categories, select "Processor", As component select "ARM_7TDMI" Close "PE Selection" dialog, by clicking "OK". The default name of the allocated PE will be "PE0" as shown in the first column of the allocation table. Rename it by left-clicking on it into "CPU". 8.2) Allocate an HW component In the "PE Allocation" dialog, click on "Add..." to add another PE. From Categories, select "Custom Hardware", select component "HW_Standard". Close the "PE Selection" dialog with "OK" and rename the PE to "HW". Finish the PE allocation by closing the "PE Allocation" dialog and click "OK". 9) Assign the behaviors to the allocated Processsing Elements (PE)s. In the behavior tree unfold the instances for "design" by clicking on the triangle pointing to the right on the left side of "design". Two child behaviors will appear "BSWRoot" and "CustHw". 9.1) Map the "BSWRoot" to the PE "CPU" Right of the "BSWRoot" is an empty column that defines the mapping to a processing element (PE). Click on the empty spot next to "UserMain". A drop down menu appears. From that menu select "CPU". This is the just allocated processor. As a result "BSSRoot" appears colored (usually red). 9.2) Map the "CustHw" Right next to "CustHw", click on the empty spot in the column "PE", select from the drop down menu the value "HW". As a result "CustHw" appears in a different color (usually blue). 9.3) Map the channel "c1". Show channels by clicking on the channel button in the button list on top of the window. Allocate channel "c1 c_hwdata_queue" to the "HW" 9.4) Perform the architecture refinement. Synthesis->Architecture Refinement ... Name the new design in the project window "Arch" 10) Schedule behaviors Synthesis->Schedule Behaviors... The dialog "Scheduling contains two tabs "CPU" and "HW". 10.1) Scheduling for the ARM processor "CPU" Select "Priority based" from the radio buttons on the right side. In dialog "Scheduling", unfold "bSWRoot" and then "bMain" and after this unfold "bPar". The third column "Priority" contains the priorities for each task. Up to now all tasks default to "1". Make the following selection. bMain 1 bSubLow 4 bSubLowLow 5 bSubHigh 3 bMain2 2 10.2) Scheduling for the "HW" Nothing do be done here. 10.3) Execute Scheduling refinement Synthesis->Scheduling Refinement... Name the new design in the project window "Sched" 11) Network Allocation Synthesis->Allocate Network ... The dialog "Network Allocation" has three tabs. The busses tab with all allocated busses is already filled correctly by default. Select the "Connectivity" tab and map the "HW" "Port0" to as a "slave4". NOTE: Really select the "slave4" the addressing depends on this! Selecting another slave and not adjusting the addresses will NOT work! 11.1) Execute Network Refinement Synthesis->Network Refinement Name the new design in the project window "Net" 12) Link Parameters Now, since the network is defined, we can select the link parameters over the network. Synthesis->Assign Link Parameters... In dialog "Link Parameters", choose the start address as "0x40000000" (make sure you have the right number of 0s!) For the Interrupt leave the value (poll), since we want to use polling for synchronization. 12.1) Execute the Link Refinement Synthesis->Communication Refinement check "Pin-accurate model" click "Start" Name the new design in the project window "Comm" 13) Generate the C code. Synthesis->C Code Generation... It automatically selects the correct behavior "ARM_7TDMI_OS_CPU (CPU)" and does chose the right file names. Click "Start" The C source code is now generated in the "CPU" sub directory. Name the new design in the project window "CommC" 14) Replace parts of the abstract behavioral model with the instruction set simulator for the ARM7TDMI. Edit->Import Design... Open the file: /opt/sce-20060301/share/sce/db/processors/general/arm7tdmiiss.sir Under the behavior tree of design is the behavior of the type "ARM_7TDMI_Core_CPU". Replace the type of its instance (called "CPU") with the instruction set simulator. Right click on "ARM_7TDMI_Core_CPU" and select "Change Type" from the context menue. The type now becomes a drop down menu. Unfold it and select "ARM_7TDMI_ISS". Save the design. Rename the design in the project window "ISS" 15) Compile the generated code into an executable for the ARM 15.1) Modify the project settings to find the swarm library. Project->Settings Add to "Library path", the swarm path: /opt/pkg/sw/swarm/src 15.2) Compile the communication model including the ISS. Validation->Compile It will create a binary called "ISS" containing the HW and the ISS. 16) Cross compile the user code using the ARM cross-compiler Go into the CPU directory and execute make. cd CPU make 17) Execute the complete model. Execute from the CPU directory (the ISS needs to find the file userCode in the current directory). ../ISS 18) Enjoy the execution... ;-) (c) 2006 G. Schirner, R. Doemer.