summaryrefslogtreecommitdiff
path: root/src/mem/slicc/symbols/StateMachine.cc
diff options
context:
space:
mode:
authorDerek Hower <drh5@cs.wisc.edu>2009-08-04 12:52:52 -0500
committerDerek Hower <drh5@cs.wisc.edu>2009-08-04 12:52:52 -0500
commit33b28fde7aca9bf1ae16b9db09e71ccd44d3ae76 (patch)
treefe2a4aee5517aed63f95e56ce4f085793826bdd4 /src/mem/slicc/symbols/StateMachine.cc
parentc1e0bd1df4cf107bd543bcde9c9ab7be41d6dce3 (diff)
downloadgem5-33b28fde7aca9bf1ae16b9db09e71ccd44d3ae76.tar.xz
slicc: added MOESI_CMP_directory, DMA SequencerMsg, parameterized controllers
This changeset contains a lot of different changes that are too mingled to separate. They are: 1. Added MOESI_CMP_directory I made the changes necessary to bring back MOESI_CMP_directory, including adding a DMA controller. I got rid of MOESI_CMP_directory_m and made MOESI_CMP_directory use a memory controller. Added a new configuration for two level protocols in general, and MOESI_CMP_directory in particular. 2. DMA Sequencer uses a generic SequencerMsg I will eventually make the cache Sequencer use this type as well. It doesn't contain an offset field, just a physical address and a length. MI_example has been updated to deal with this. 3. Parameterized Controllers SLICC controllers can now take custom parameters to use for mapping, latencies, etc. Currently, only int parameters are supported.
Diffstat (limited to 'src/mem/slicc/symbols/StateMachine.cc')
-rw-r--r--src/mem/slicc/symbols/StateMachine.cc75
1 files changed, 24 insertions, 51 deletions
diff --git a/src/mem/slicc/symbols/StateMachine.cc b/src/mem/slicc/symbols/StateMachine.cc
index 4a9ee3714..7bc84ffe0 100644
--- a/src/mem/slicc/symbols/StateMachine.cc
+++ b/src/mem/slicc/symbols/StateMachine.cc
@@ -43,14 +43,25 @@
#include "mem/slicc/symbols/SymbolTable.hh"
#include "mem/gems_common/util.hh"
#include "mem/gems_common/Vector.hh"
+#include "mem/slicc/ast/FormalParamAST.hh"
#include <set>
-StateMachine::StateMachine(string ident, const Location& location, const Map<string, string>& pairs, std::vector<std::string*>* latency_vector)
+StateMachine::StateMachine(string ident, const Location& location, const Map<string, string>& pairs, Vector<FormalParamAST*>* config_parameters)
: Symbol(ident, location, pairs)
{
m_table_built = false;
- m_latency_vector = *latency_vector;
+ m_config_parameters = config_parameters;
+
+ for (int i=0; i< m_config_parameters->size(); i++) {
+ Var* var = new Var(m_config_parameters->ref(i)->getName(),
+ location,
+ m_config_parameters->ref(i)->getType(),
+ "m_"+m_config_parameters->ref(i)->getName(),
+ Map<string, string>(),
+ this);
+ g_sym_table.registerSym(m_config_parameters->ref(i)->getName(), var);
+ }
}
StateMachine::~StateMachine()
@@ -284,9 +295,8 @@ void StateMachine::printControllerH(ostream& out, string component)
out << "private:" << endl;
//added by SS
// found_to_mem = 0;
- std::vector<std::string*>::const_iterator it;
- for(it=m_latency_vector.begin();it!=m_latency_vector.end();it++){
- out << " int m_" << (*it)->c_str() << ";" << endl;
+ for(int i=0;i<m_config_parameters->size();i++){
+ out << " int m_" << m_config_parameters->ref(i)->getName() << ";" << endl;
}
if (strncmp(component.c_str(), "L1Cache", 7) == 0) {
out << " bool servicing_atomic;" << endl;
@@ -429,41 +439,22 @@ void StateMachine::printControllerC(ostream& out, string component)
out << " else if (argv[i] == \"number_of_TBEs\") " << endl;
out << " m_number_of_TBEs = atoi(argv[i+1].c_str());" << endl;
- if (m_latency_vector.size()) {
- out << " else { " << endl;
- std::vector<std::string*>::const_iterator it;
- for(it=m_latency_vector.begin();it!=m_latency_vector.end();it++) {
- string str = (*it)->c_str();
- str.erase(0,8);
-//convert to lowercase
- size_t i;
- char* strc = (char*) malloc (str.length()+1);
- strc[str.length()]=0;
- for(i=0; i < str.length(); i++) {
- strc[i] = str.at(i);
- strc[i] = tolower(strc[i]);
- }
- str = strc;
- delete strc;
- out << " if (argv[i] == \"" << str << "\"){" << endl;
- if (str == "to_mem_ctrl_latency")
- out << " m_" << (*it)->c_str() << "=" << "atoi(argv[i+1].c_str())+(random() % 5);" << endl;
+ if (m_config_parameters->size()) {
+ for(int i= 0 ; i < m_config_parameters->size(); i++) {
+ out << " else if (argv[i] == \"" << m_config_parameters->ref(i)->getName() << "\")" << endl;
+ if (m_config_parameters->ref(i)->getTypeName() == "int")
+ out << " m_" << m_config_parameters->ref(i)->getName() << "=" << "atoi(argv[i+1].c_str());" << endl;
else
- out << " m_" << (*it)->c_str() << "=" << "atoi(argv[i+1].c_str());" << endl;
-// out << " printf (\"SET m_" << it->c_str() << "= %i \\n \", m_" << it->c_str() << ");" << endl;
- out << " }" << endl;
+ assert(0); // only int parameters are supported right now
+ // if (str == "to_mem_ctrl_latency")
+ // out << " m_" << (*it)->c_str() << "=" << "atoi(argv[i+1].c_str())+(random() % 5);" << endl;
}
- out << " }" << endl;
}
out << " }" << endl;
-
out << " m_net_ptr = net_ptr;" << endl;
out << " m_machineID.type = MachineType_" << component << ";" << endl;
out << " m_machineID.num = m_version;" << endl;
-// out << " printf (\"I set m_LATENCY_ISSUE_LATENCY to %i \\n \", m_LATENCY_ISSUE_LATENCY);" << endl;
-// out << " printf (\"I set m_LATENCY_CACHE_RESPONSE_LATENCY to %i \\n \", m_LATENCY_CACHE_RESPONSE_LATENCY);" << endl;
-
// make configuration array
out << " for (size_t i=0; i < argv.size(); i+=2) {" << endl;
out << " if (argv[i] != \"version\") " << endl;
@@ -724,25 +715,7 @@ void StateMachine::printControllerC(ostream& out, string component)
string c_code_string = action.lookupPair("c_code");
-/*
- size_t found = c_code_string.find("RubyConfig::get");
-
- if (found!=string::npos){ //found --> replace it with local access
- //if it is related to latency --> replace it
- std::vector<std::string*>::const_iterator it;
- for(it=m_latency_vector.begin();it!=m_latency_vector.end();it++){
- string str = (*it)->c_str();
- str.erase(0,8);
- size_t fd = c_code_string.find(str, found);
- if (fd!=string::npos && (fd == found+15)){
- string rstr = "m_";
- rstr += (*it)->c_str();
- c_code_string.replace(found,15+str.size()+2,rstr);
- break;
- }
- }
- }
-*/
+
// add here:
if (strncmp(component.c_str(), "L1Cache", 7) == 0) {
if (c_code_string.find("writeCallback") != string::npos) {