aboutsummaryrefslogtreecommitdiff
path: root/src/abstract_hardware_model.h
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-07-19 23:29:18 -0800
committerTor Aamodt <[email protected]>2010-07-19 23:29:18 -0800
commit55106068e9087f253bbeb587a763055620e59441 (patch)
treeb82de10a84fa023fa694af4cee0229bbbf98a927 /src/abstract_hardware_model.h
parent7f931254bd1468c2db4fc7a954550e89c3d742f4 (diff)
OpenCL running on simulator w/ CUDA 3.1 and nvidia driver 256.35
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6907]
Diffstat (limited to 'src/abstract_hardware_model.h')
-rw-r--r--src/abstract_hardware_model.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h
index 4c6e23e..528b120 100644
--- a/src/abstract_hardware_model.h
+++ b/src/abstract_hardware_model.h
@@ -24,7 +24,7 @@ typedef unsigned addr_t;
#define BRANCH_OP 4000
#define BARRIER_OP 5000
-typedef enum _memory_space_t {
+enum _memory_space_t {
undefined_space=0,
reg_space,
local_space,
@@ -37,6 +37,34 @@ typedef enum _memory_space_t {
surf_space,
global_space,
generic_space
-} memory_space_t;
+};
+
+#ifdef __cplusplus
+
+class memory_space_t {
+public:
+ memory_space_t() { m_type = undefined_space; m_bank=0; }
+ memory_space_t( const enum _memory_space_t &from ) { m_type = from; m_bank = 0; }
+ bool operator==( const memory_space_t &x ) const { return (m_bank == x.m_bank) && (m_type == x.m_type); }
+ bool operator!=( const memory_space_t &x ) const { return !(*this == x); }
+ bool operator<( const memory_space_t &x ) const
+ {
+ if(m_type < x.m_type)
+ return true;
+ else if(m_type > x.m_type)
+ return false;
+ else if( m_bank < x.m_bank )
+ return true;
+ return false;
+ }
+ enum _memory_space_t get_type() const { return m_type; }
+ unsigned get_bank() const { return m_bank; }
+ void set_bank( unsigned b ) { m_bank = b; }
+private:
+ enum _memory_space_t m_type;
+ unsigned m_bank; // n in ".const[n]"; note .const == .const[0] (see PTX 2.1 manual, sec. 5.1.3)
+};
+
+#endif
#endif