Fix V3File dependency issue

This commit is contained in:
Todd Strader 2020-01-21 07:04:01 -05:00
parent 29b8b24b07
commit 2b93cfb364
6 changed files with 15 additions and 12 deletions

View File

@ -35,7 +35,7 @@ int VerilatedReplay::init() {
addOutputName(it->first);
}
openFst(m_fstName);
searchFst("");
searchFst(NULL);
m_time = fstReaderGetStartTime(m_fstp);
// TODO -- use FST timescale
m_simTime = m_time;

View File

@ -46,9 +46,9 @@ void VerilatedReplayCommon::openFst(const string& fstName) {
}
}
void VerilatedReplayCommon::searchFst(const string& targetScope) {
void VerilatedReplayCommon::searchFst(const char* targetScope) {
const char* scope = "";
string searchScope(targetScope);
string searchScope(string(targetScope ? targetScope : ""));
while (fstHier* hierp = fstReaderIterateHier(m_fstp)) {
if (hierp->htyp == FST_HT_SCOPE) {

View File

@ -53,7 +53,7 @@ public:
VerilatedReplayCommon() {}
~VerilatedReplayCommon() {}
void openFst(const std::string& fstName);
void searchFst(const std::string& targetScope);
void searchFst(const char* targetScope);
void addInputName(const std::string& name) { m_inputNames.insert(name); }
void addOutputName(const std::string& name) { m_outputNames.insert(name); }
};

View File

@ -259,8 +259,8 @@ VLCOV_OBJS = \
# verilator_replay
VLREPLAY_OBJS = \
V3Error.o \
V3File.o \
V3Os.o \
V3String.o \
VlrOptions.o \
verilated_replay_common.o \
VlrGenerator.o \

View File

@ -4,7 +4,7 @@
void VlrGenerator::searchFst() {
openFst(string(m_opts.fst()));
VerilatedReplayCommon::searchFst(string(m_opts.scope()));
VerilatedReplayCommon::searchFst(m_opts.scope());
}
void VlrGenerator::emitVltCode() {

View File

@ -25,6 +25,7 @@
#include "V3File.h"
#include "V3Os.h"
#include <memory>
#include <fstream>
void VlrOptions::parseOptsList(int argc, char** argv) {
// Parse parameters
@ -122,14 +123,14 @@ bool VlrOptions::onoff(const char* sw, const char* arg, bool& flag) {
}
void VlrOptions::readSignalList(const char* filename) {
const vl_unique_ptr<std::ifstream> ifp (V3File::new_ifstream(string(filename)));
if (ifp->fail()) {
std::ifstream ifs(filename);
if (ifs.fail()) {
v3fatal("Cannot open -f command file: "+string(filename));
return;
}
while (!ifp->eof()) {
string line = V3Os::getline(*ifp);
while (!ifs.eof()) {
string line = V3Os::getline(ifs);
// Remove comments
size_t cmt = line.find("#");
@ -140,11 +141,13 @@ void VlrOptions::readSignalList(const char* filename) {
}
// Parse signals
if (line.length() <= 2) continue;
string signalName = line.substr(2);
if (line[0] == 'I' && line[1] == ' ') {
if (line.substr(0, 2) == "I ") {
m_replayp->addInputName(signalName);
} else if (line[0] == 'O' && line[1] == ' ') {
} else if (line.substr(0, 2) == "O ") {
m_replayp->addOutputName(signalName);
} else {
v3fatal("Invalid signal line: "+line);