1
0
rocket-chip/csrc/verilator.h
Edmond Cote ff11673a9c
remove string type ambiguity in header
I ran into a compilation issue.

This link explains the problem well: https://stackoverflow.com/a/5499222/3736700

For example, in a header file, it is generally not considered a good idea to put the line using namespace std; (or to use any namespace, for that matter) because it can cause names in files that include that header to become ambiguous. In this setup, you would just #include <string> in the header, then use std::string to refer to the string type.
2018-01-13 13:29:22 -08:00

30 lines
621 B
C++

#ifndef _ROCKET_VERILATOR_H
#define _ROCKET_VERILATOR_H
#include "verilated_vcd_c.h"
#include <stdlib.h>
#include <stdio.h>
extern bool verbose;
extern bool done_reset;
class VerilatedVcdFILE : public VerilatedVcdFile {
public:
VerilatedVcdFILE(FILE* file) : file(file) {}
~VerilatedVcdFILE() {}
bool open(const std::string& name) override {
// file should already be open
return file != NULL;
}
void close() override {
// file should be closed elsewhere
}
ssize_t write(const char* bufp, ssize_t len) override {
return fwrite(bufp, 1, len, file);
}
private:
FILE* file;
};
#endif