Exercise 6 - Multicore Platform

General Information

Exercise Tips

Motivation

Objectives

This exercise will be divided into parts and, at the end of them, you should be able to:

Contextualization

Attention: As always, all the files you need for this activity are available at / home / staff / rodolfo / mc723 / download.

Part 1 - Creating a multicore platform

The description of this part is very simple: take the platform from the previous exercise and make it work with two processors. For this, create a new platform with the name dual_mips and assemble the rest of the necessary structure, according to the following steps.

Use the results of exercise 4 as a base with the Lock peripheral, without the peripherals for floating point arithmetic operations. Since you already tested this code in exercise 4, you probably won't find any problems here (this is the code for the first execution of the matrix multiplication program, just rename the necessary files to have another platform as indicated above).

Instantiate two processors in the file main.cpp. Connect these two processors to the router. You will have to create another similar door target_export. This should be enough for your simulator to start running, unless it tries to run exactly the same program twice, which is not the goal of this exercise. Three steps will be necessary to separate the execution flow, they are: make all processors start the same way, provide a different stack for each processor and separate the execution flow No.

To start all processors in the same way, the only care you should take is to call the method init within main.cpp. This method receives the parameters from the command line more, by the way it was implemented, removes the first parameter from the list. Thus, if you pass the same variables to all processors, each one will receive a parameter less than the previous one. Tip: mount the command lines already on the main.cpp correctly or duplicate all parameters before calling the method init.

Each thread of execution needs a separate stack, otherwise the behavior of the running program will be inconsistent. To provide a different stack for each thread, there are two simple alternatives: inserting an inline assembly code at the beginning of the program. Make sure you have each processor with a different stack address (I recommend 32Kb or 64Kb per stack). If using inline assembly, separate the execution flow first, as described in the following paragraph. Another alternative is to edit the mips1_syscall.cpp file, when it starts the $ SP register, and set a different initial value each time you pass through this line of code. So you guarantee complete scalability, without having to worry about the number of processors or the inline assembly code.

Separate the execution of each thread. You must use the lock peripheral, defined and implemented in exercise 4, to manage competition control in a memory position and perform a different activity each time that section is executed. Remember the code examples from exercise 4. I suggest that you implement the functions: AcquireGlobalLock, ReleaseGlobalLock, AcquireLock and ReleaseLock. The first two work with the global hardware lock and the other two with locks based on local variables. To implement these last two, you must obtain the global lock first and make changes to these variables. So, with just one global lock you can have as many local locks as needed.

Describe your design decisions. I will be available in the lab to discuss possible design decisions and how to implement them.

Create a program, however simple, that takes advantage of its parallel platform. What is the simulator's performance?

Part 2 - Scalability

How scalable is your platform? Can you make a 4-color version? 8 colors? Do them and run your program. Evaluate the simulator's performance.

Prepare the 8-color version for delivery.

Delivery

The code of this activity will have to be delivered. Send the report via Susy and keep the code in your area until I request it. Submit a report only 1 page describing the activity performed and the results obtained.