From 0d717f7c9409a68dd6e2c65eaa86fee1a2019dcc Mon Sep 17 00:00:00 2001 From: "Andrew M. B. Boktor" Date: Mon, 23 Apr 2012 14:00:25 -0800 Subject: This changelist adds the following: 1. A configurable number of functional units within each SM 2. A configurable pipeline widths (i.e. Issue width, writeback width ...). Merging //depot/gpgpu_sim_research/fermi_replay/distribution/src/... to //depot/gpgpu_sim_research/fermi/distribution/src/... [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12091] --- src/abstract_hardware_model.h | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'src/abstract_hardware_model.h') diff --git a/src/abstract_hardware_model.h b/src/abstract_hardware_model.h index 4bfdda9..28dc6cb 100644 --- a/src/abstract_hardware_model.h +++ b/src/abstract_hardware_model.h @@ -862,6 +862,84 @@ class core_t { class ptx_thread_info ** m_thread; }; + +//register that can hold multiple instructions. +class register_set { +public: + register_set(unsigned num, const char* name){ + for( unsigned i = 0; i < num; i++ ) { + regs.push_back(new warp_inst_t()); + } + m_name = name; + } + bool has_free(){ + for( unsigned i = 0; i < regs.size(); i++ ) { + if( regs[i]->empty() ) { + return true; + } + } + return false; + } + bool has_ready(){ + for( unsigned i = 0; i < regs.size(); i++ ) { + if( not regs[i]->empty() ) { + return true; + } + } + return false; + } + + void move_in( warp_inst_t *&src ){ + warp_inst_t** free = get_free(); + move_warp(*free, src); + } + //void copy_in( warp_inst_t* src ){ + // src->copy_contents_to(*get_free()); + //} + void move_out_to( warp_inst_t *&dest ){ + warp_inst_t **ready=get_ready(); + move_warp(dest, *ready); + } + + warp_inst_t** get_ready(){ + warp_inst_t** ready; + ready = NULL; + for( unsigned i = 0; i < regs.size(); i++ ) { + if( not regs[i]->empty() ) { + if( ready and (*ready)->get_uid() < regs[i]->get_uid() ) { + // ready is oldest + } else { + ready = ®s[i]; + } + } + } + return ready; + } + + void print(FILE* fp) const{ + fprintf(fp, "%s : @%p\n", m_name, this); + for( unsigned i = 0; i < regs.size(); i++ ) { + fprintf(fp, " "); + regs[i]->print(fp); + fprintf(fp, "\n"); + } + } + + warp_inst_t ** get_free(){ + for( unsigned i = 0; i < regs.size(); i++ ) { + if( regs[i]->empty() ) { + return ®s[i]; + } + } + assert(0 && "No free registers found"); + return NULL; + } + +private: + std::vector regs; + const char* m_name; +}; + #endif // #ifdef __cplusplus #endif // #ifndef ABSTRACT_HARDWARE_MODEL_INCLUDED -- cgit v1.3