Skip to content

Commit

Permalink
Merge pull request #2269 from jeffng-or/mockarray-simulate-power-2
Browse files Browse the repository at this point in the history
Updated env var usage in Verilator simulation flow per PR feedback
  • Loading branch information
maliberty authored Aug 20, 2024
2 parents 346faf6 + 42fa253 commit c6ea30d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
7 changes: 0 additions & 7 deletions flow/designs/asap7/mock-array/simulate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@
#
set -ex


RESULTS_DIR="$FLOW_HOME/results/asap7/mock-array/base"
OBJ_DIR="$RESULTS_DIR/verilator/obj"
POST_DIR="$RESULTS_DIR/verilator/post"

# If you run outside of the Makefile system, then PLATFORM_DIR won't be set
if [[ -z "$PLATFORM_DIR" ]]; then
PLATFORM_DIR="$FLOW_HOME/platforms/asap7"
fi

# Make sure the output directories are created
mkdir -p $OBJ_DIR
mkdir -p $POST_DIR
Expand Down
15 changes: 9 additions & 6 deletions flow/designs/src/mock-array/simulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
#include <verilated_vcd_c.h>

/**
* Returns the VCD output path under the results directory
* Returns the VCD output path.
*
* If RESULTS_DIR is set, the VCD file will be written there. If not, it will be written to the
* current directory.
**/
static std::string getVCDFilePath() {

std::string vcd_file_name = "results/asap7/mock-array/base/MockArrayTestbench.vcd";
std::string flow_home_dir = getenv("FLOW_HOME");
if (flow_home_dir.empty()) {
flow_home_dir = ".";
std::string results_dir = getenv("RESULTS_DIR");
std::string vcd_file_name = "MockArrayTestbench.vcd";
if (results_dir.empty()) {
results_dir = ".";
}
std::string vcd_path = flow_home_dir + "/" + vcd_file_name;
std::string vcd_path = results_dir + "/" + vcd_file_name;
return vcd_path;
}

Expand Down

0 comments on commit c6ea30d

Please sign in to comment.