summaryrefslogtreecommitdiff
path: root/src/mem/slicc/ast
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/ast
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/ast')
-rw-r--r--src/mem/slicc/ast/AST.hh14
-rw-r--r--src/mem/slicc/ast/ActionDeclAST.cc2
-rw-r--r--src/mem/slicc/ast/ActionDeclAST.hh3
-rw-r--r--src/mem/slicc/ast/EnqueueStatementAST.cc9
-rw-r--r--src/mem/slicc/ast/FormalParamAST.cc11
-rw-r--r--src/mem/slicc/ast/FormalParamAST.hh6
-rw-r--r--src/mem/slicc/ast/FuncDeclAST.cc1
-rw-r--r--src/mem/slicc/ast/FuncDeclAST.hh3
-rw-r--r--src/mem/slicc/ast/MachineAST.cc9
-rw-r--r--src/mem/slicc/ast/MachineAST.hh8
10 files changed, 46 insertions, 20 deletions
diff --git a/src/mem/slicc/ast/AST.hh b/src/mem/slicc/ast/AST.hh
index 53f9a6c33..33c9b84ed 100644
--- a/src/mem/slicc/ast/AST.hh
+++ b/src/mem/slicc/ast/AST.hh
@@ -50,28 +50,28 @@ public:
// Constructors
AST(Map<string, string> pairs) { m_pairs = pairs; };
AST() {};
-
+
// Destructor
virtual ~AST() {};
-
+
// Public Methods
virtual void print(ostream& out) const = 0;
void error(string err_msg) const { m_location.error(err_msg); };
string embedError(string err_msg) const { return m_location.embedError(err_msg); };
void warning(string err_msg) const { m_location.warning(err_msg); };
-
+
const Location& getLocation() const { return m_location; };
-
+
const Map<string, string>& getPairs() const { return m_pairs; };
Map<string, string>& getPairs() { return m_pairs; };
-
+
private:
// Private Methods
-
+
// Private copy constructor and assignment operator
// AST(const AST& obj);
// AST& operator=(const AST& obj);
-
+
// Data Members (m_ prefix)
Location m_location;
Map<string, string> m_pairs;
diff --git a/src/mem/slicc/ast/ActionDeclAST.cc b/src/mem/slicc/ast/ActionDeclAST.cc
index 2734722d1..e46412ff7 100644
--- a/src/mem/slicc/ast/ActionDeclAST.cc
+++ b/src/mem/slicc/ast/ActionDeclAST.cc
@@ -36,8 +36,10 @@
*
*/
+
#include "mem/slicc/ast/ActionDeclAST.hh"
#include "mem/slicc/symbols/Action.hh"
+#include "mem/slicc/ast/StatementListAST.hh"
ActionDeclAST::ActionDeclAST(string* ident_ptr,
PairListAST* pairs_ptr,
diff --git a/src/mem/slicc/ast/ActionDeclAST.hh b/src/mem/slicc/ast/ActionDeclAST.hh
index 53d938ca8..4970ee254 100644
--- a/src/mem/slicc/ast/ActionDeclAST.hh
+++ b/src/mem/slicc/ast/ActionDeclAST.hh
@@ -41,7 +41,8 @@
#include "mem/slicc/slicc_global.hh"
#include "mem/slicc/ast/DeclAST.hh"
-#include "mem/slicc/ast/StatementListAST.hh"
+
+class StatementListAST;
class ActionDeclAST : public DeclAST {
public:
diff --git a/src/mem/slicc/ast/EnqueueStatementAST.cc b/src/mem/slicc/ast/EnqueueStatementAST.cc
index 8be0378c9..a422d8a28 100644
--- a/src/mem/slicc/ast/EnqueueStatementAST.cc
+++ b/src/mem/slicc/ast/EnqueueStatementAST.cc
@@ -77,7 +77,14 @@ void EnqueueStatementAST::generate(string& code, Type* return_type_ptr) const
code += ".enqueue(out_msg";
if (getPairs().exist("latency")) {
- code += ", m_LATENCY_" + getPairs().lookup("latency");
+ bool is_number = true;
+ string val = getPairs().lookup("latency");
+ for (int i=0; i<val.size(); i++)
+ if (!isdigit(val[i])) is_number = false;
+ if (is_number)
+ code += ", " + getPairs().lookup("latency");
+ else
+ code += ", m_" + getPairs().lookup("latency");
}
code += ");\n";
diff --git a/src/mem/slicc/ast/FormalParamAST.cc b/src/mem/slicc/ast/FormalParamAST.cc
index 4ca2c8978..529811f25 100644
--- a/src/mem/slicc/ast/FormalParamAST.cc
+++ b/src/mem/slicc/ast/FormalParamAST.cc
@@ -38,6 +38,7 @@
#include "mem/slicc/ast/FormalParamAST.hh"
#include "mem/slicc/ast/StatementAST.hh"
+#include "mem/slicc/ast/TypeAST.hh"
#include "mem/slicc/symbols/SymbolTable.hh"
FormalParamAST::~FormalParamAST()
@@ -46,6 +47,16 @@ FormalParamAST::~FormalParamAST()
delete m_type_ast_ptr;
}
+string FormalParamAST::getTypeName() const
+{
+ return m_type_ast_ptr->toString();
+}
+
+Type* FormalParamAST::getType() const
+{
+ return m_type_ast_ptr->lookupType();
+}
+
Type* FormalParamAST::generate(string& code) const
{
string param = "param_" + *m_ident_ptr;
diff --git a/src/mem/slicc/ast/FormalParamAST.hh b/src/mem/slicc/ast/FormalParamAST.hh
index 63d66cc03..ca27948b7 100644
--- a/src/mem/slicc/ast/FormalParamAST.hh
+++ b/src/mem/slicc/ast/FormalParamAST.hh
@@ -40,7 +40,9 @@
#define FORMALPARAMAST_H
#include "mem/slicc/slicc_global.hh"
-#include "mem/slicc/ast/TypeAST.hh"
+#include "mem/slicc/ast/AST.hh"
+
+class TypeAST;
class FormalParamAST : public AST {
@@ -55,6 +57,8 @@ public:
Type* generate(string& code) const;
void print(ostream& out) const { out << "[FormalParamAST: " << *m_ident_ptr << "]"; }
string getName() const { return *m_ident_ptr; }
+ string getTypeName() const;
+ Type* getType() const;
private:
// Private Methods
diff --git a/src/mem/slicc/ast/FuncDeclAST.cc b/src/mem/slicc/ast/FuncDeclAST.cc
index 7fb0e6346..2a0905f06 100644
--- a/src/mem/slicc/ast/FuncDeclAST.cc
+++ b/src/mem/slicc/ast/FuncDeclAST.cc
@@ -37,6 +37,7 @@
*/
#include "mem/slicc/ast/FuncDeclAST.hh"
+#include "mem/slicc/ast/FormalParamAST.hh"
#include "mem/slicc/symbols/SymbolTable.hh"
#include "mem/slicc/main.hh"
diff --git a/src/mem/slicc/ast/FuncDeclAST.hh b/src/mem/slicc/ast/FuncDeclAST.hh
index d60694303..205e71a85 100644
--- a/src/mem/slicc/ast/FuncDeclAST.hh
+++ b/src/mem/slicc/ast/FuncDeclAST.hh
@@ -43,7 +43,8 @@
#include "mem/slicc/ast/DeclAST.hh"
#include "mem/slicc/ast/TypeFieldAST.hh"
#include "mem/slicc/ast/TypeAST.hh"
-#include "mem/slicc/ast/FormalParamAST.hh"
+
+class FormalParamsAST;
class FuncDeclAST : public DeclAST {
public:
diff --git a/src/mem/slicc/ast/MachineAST.cc b/src/mem/slicc/ast/MachineAST.cc
index 2096db591..ae8026458 100644
--- a/src/mem/slicc/ast/MachineAST.cc
+++ b/src/mem/slicc/ast/MachineAST.cc
@@ -37,21 +37,20 @@
*/
#include "mem/slicc/ast/MachineAST.hh"
+#include "mem/slicc/ast/FormalParamAST.hh"
#include "mem/slicc/symbols/SymbolTable.hh"
MachineAST::MachineAST(string* ident_ptr,
PairListAST* pairs_ptr,
- Vector<TypeFieldAST*>* config_params_ptr,
- std::vector<std::string*>* latency_vector,
+ Vector<FormalParamAST*>* config_parameters,
DeclListAST* decl_list_ptr)
: DeclAST(pairs_ptr)
{
m_ident_ptr = ident_ptr;
m_pairs_ptr = pairs_ptr;
- m_config_params_ptr = config_params_ptr;
+ m_config_parameters = config_parameters;
m_decl_list_ptr = decl_list_ptr;
- m_latency_vector = latency_vector;
}
MachineAST::~MachineAST()
@@ -69,7 +68,7 @@ void MachineAST::generate()
g_sym_table.pushFrame();
// Create a new machine
- machine_ptr = new StateMachine(*m_ident_ptr, getLocation(), getPairs(), m_latency_vector);
+ machine_ptr = new StateMachine(*m_ident_ptr, getLocation(), getPairs(), m_config_parameters);
g_sym_table.newCurrentMachine(machine_ptr);
// Generate code for all the internal decls
diff --git a/src/mem/slicc/ast/MachineAST.hh b/src/mem/slicc/ast/MachineAST.hh
index 8f83e4cfe..5d1bc2a1c 100644
--- a/src/mem/slicc/ast/MachineAST.hh
+++ b/src/mem/slicc/ast/MachineAST.hh
@@ -45,13 +45,14 @@
#include "mem/slicc/ast/TypeFieldAST.hh"
#include "mem/slicc/symbols/StateMachine.hh"
+class FormalParamAST;
+
class MachineAST : public DeclAST {
public:
// Constructors
MachineAST(string* ident_ptr,
PairListAST* pairs_ptr,
- Vector<TypeFieldAST*>* config_params_ptr,
- std::vector<std::string*>* latency_vector,
+ Vector<FormalParamAST*>* config_parameters,
DeclListAST* decl_list_ptr);
// Destructor
@@ -69,10 +70,9 @@ private:
MachineAST& operator=(const MachineAST& obj);
// Data Members (m_ prefix)
- std::vector<std::string*>* m_latency_vector;
+ Vector<FormalParamAST*>* m_config_parameters;
string* m_ident_ptr;
DeclListAST* m_decl_list_ptr;
- Vector<TypeFieldAST*>* m_config_params_ptr;
PairListAST* m_pairs_ptr;
};