00001
00002 #if !defined(oagFpgaSimMod_P)
00003 #define oagFpgaSimMod_P
00004
00005 #include "oaDesignDB.h"
00006 #include "oagFpga.h"
00007 #include "oagFpgaAiModGraph.h"
00008 #include <list>
00009 #include <map>
00010
00011 using namespace std;
00012
00013 namespace oagFpga {
00014
00015
00016
00017
00019
00020
00021
00022 class SimMod {
00023
00024 public:
00025
00026 SimMod(oa::oaDesign *design);
00027
00028 typedef unsigned int SimVec;
00029
00030 static const int SIM_USER_DATA_INDEX = 0;
00031
00032 inline void setVector(const AiModRef &ref, SimVec vec) {
00033 if (AiModGraph::isInverted(ref)) {
00034 AiModGraph::setUserData(ref, SIM_USER_DATA_INDEX, ~vec);
00035 } else {
00036 AiModGraph::setUserData(ref, SIM_USER_DATA_INDEX, vec);
00037 }
00038 toBeSimulated.push_back(AiModGraph::getNonInverted(ref));
00039 }
00040 void generateRandomInputVectors();
00041 void generateRandomStateVectors();
00042 void clear();
00043
00044 void nextCycle();
00045
00046 void runFull();
00047
00048 void initializeIncremental();
00049 void runIncremental();
00050 void runOne(const AiModRef & ref);
00051
00052 inline void getVector(const AiModRef &ref, SimVec &vec) {
00053 vec = AiModGraph::getUserData(ref, SIM_USER_DATA_INDEX);
00054 }
00055
00056 protected:
00057
00058 SimVec randomVector();
00059 int BITS_PER_RAND;
00060
00061 oa::oaDesign *design;
00062 list<AiModRef> toBeSimulated;
00063 };
00064
00065 }
00066
00067 #endif