MicroGPU 1.0
Simple functional model of a GPU for educational purposes
Loading...
Searching...
No Matches
ugpu.hh
Go to the documentation of this file.
1#ifndef MICROGPU_HH
2#define MICROGPU_HH
3#include<iostream>
4#include<string>
5#include<vector>
6#include<array>
7#include<bitset>
8
9#include "../warp/warp.hh"
10#include "../computeUnit/computeUnit.hh"
11
13#define CU_COUNT 16
26class MicroGPU {
27 std::vector <Warp> globalWarpCollection;
28
29 // Collection of Streaming Multiprocessors
30 std::array<ComputeUnit, CU_COUNT> computeUnit;
33
34 public:
35 MicroGPU();
36 void init();
37 void assignWarpToSM(int smId, const Warp &warp);
38
45 void addWarpToGlobalCollection(const Warp &warp);
47 int getCurrentCycle() const { return currentCycle; }
50
57 void setMaxCycles(int cycles) { maxCycles = cycles; }
58
59 // test method
67 void printComputeUnitStatus() const;
68 bool allComputeUnitsDone() const;
69 bool allWarpsCompleted() const;
70
75 void executeComputeUnits(); // Method to execute warps in compute units for one cycle
76
81 void executeGPU(); // Method to execute the entire GPU until all warps are completed
82
83
84};
85#endif // MICROGPU_HH
Represents a microGPUThe MicroGPU class encapsulates the state and behavior of a microGPU,...
Definition ugpu.hh:26
int currentCycle
Definition ugpu.hh:31
void init()
Definition ugpu.cc:8
void setMaxCycles(int cycles)
Definition ugpu.hh:57
std::array< ComputeUnit, CU_COUNT > computeUnit
Definition ugpu.hh:30
void executeGPU()
Execute the entire GPU until all warps are completed.
Definition ugpu.cc:126
void performWarpSchedulingSimple()
Perform simple warp scheduling This function assigns alternating warps from the global collection to ...
Definition ugpu.cc:108
void createGlobalWarpCollectionTest()
Create a Global Warp Collection Test object This method creates a set of test warps with simple instr...
Definition ugpu.cc:28
int getCurrentCycle() const
Definition ugpu.hh:47
std::vector< Warp > globalWarpCollection
Definition ugpu.hh:27
void performWarpScheduling()
Definition ugpu.cc:64
void assignWarpToSM(int smId, const Warp &warp)
Definition ugpu.cc:77
void addWarpToGlobalCollection(const Warp &warp)
Add a warp to the global warp collection.
Definition ugpu.cc:19
bool allWarpsCompleted() const
Definition ugpu.cc:100
int maxCycles
Definition ugpu.hh:32
void printComputeUnitStatus() const
Definition ugpu.cc:82
void executeComputeUnits()
Execute all compute units for one cycle.
Definition ugpu.cc:120
int getGlobalWarpCollectionSize() const
Definition ugpu.cc:24
bool allComputeUnitsDone() const
Definition ugpu.cc:91
void incrementCycle()
Definition ugpu.hh:48
MicroGPU()
Definition ugpu.cc:3
Represents a GPU warpThe Warp class encapsulates the state and behavior of a GPU warp,...
Definition warp.hh:90