Skip to content

Commit

Permalink
1.bugfix SaleaeParser 2.Path to verilator executable 3.Liberty parser…
Browse files Browse the repository at this point in the history
… test removed for MacOS
  • Loading branch information
joern274 committed May 17, 2024
1 parent ee3e0cb commit c5809ed
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions plugins/liberty_parser/test/liberty_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ namespace hal {
auto gl_res = liberty_parser.parse(path_lib);
ASSERT_TRUE(gl_res.is_error());
}
#if !defined (__APPLE__)
{
// Use a pin with an unknown direction (not in {input, output}) as an input pin
NO_COUT_TEST_BLOCK;
Expand All @@ -406,6 +407,7 @@ namespace hal {
auto gl_res = liberty_parser.parse(path_lib);
ASSERT_TRUE(gl_res.is_error());
}
#endif
// { // NOTE: Works (is ok?)
// // Use an unknown variable in a boolean function
// NO_COUT_TEST_BLOCK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ namespace hal
{
auto it = mNextValueMap.begin();
if (it == mNextValueMap.end()) return false;
uint64_t currT = it->first;
DataFileHandle wff = it->second;
mNextValueMap.erase(it);
// std::cerr << "SaleaeParser::callback o=" << std::hex << (uintptr_t)wff.obj << " t=" << std::dec << it->first << " v=" << wff.value << " size=" << mNextValueMap.size() << std::endl;
wff.callback(wff.obj,it->first,wff.value);
// std::cerr << "SaleaeParser::callback o=" << std::hex << (uintptr_t)wff.obj << " t=" << std::dec << currT << " v=" << wff.value << " size=" << mNextValueMap.size() << std::endl;
wff.callback(wff.obj,currT,wff.value);
if (wff.file->good())
{
SaleaeDataTuple sdt = wff.file->get_next_value();
Expand Down
1 change: 1 addition & 0 deletions plugins/simulator/verilator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include/verilator/path_to_verilator_executable.h
8 changes: 7 additions & 1 deletion plugins/simulator/verilator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ option(PL_VERILATOR "PL_VERILATOR" OFF)

if(PL_VERILATOR OR PL_SIMULATOR OR BUILD_ALL_PLUGINS)

set (PATH_TO_VERILATOR_EXECUTABLE "")
find_package(verilator HINTS $ENV{VERILATOR_ROOT})
if(verilator_FOUND)
set (PATH_TO_VERILATOR_EXECUTABLE "${verilator_DIR}/bin/")
endif(verilator_FOUND)
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/include/verilator/path_to_verilator_executable.h" "#pragma once\n\nconst char* path_to_verilator_executable = \"${PATH_TO_VERILATOR_EXECUTABLE}\";\n")

file(GLOB_RECURSE VERILATOR_INC ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
file(GLOB_RECURSE VERILATOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE VERILATOR_PYTHON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/python/*.cpp)


enable_cxx_compile_option_if_supported("-O1" "Perf" "PUBLIC")
enable_cxx_compile_option_if_supported("-g" "Perf" "PUBLIC")
enable_cxx_compile_option_if_supported("-fno-inline-functions" "Perf" "PUBLIC")
Expand Down
6 changes: 6 additions & 0 deletions plugins/simulator/verilator/src/verilator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "verilator/verilator.h"
#include "verilator/path_to_verilator_executable.h"

#include "hal_core/netlist/boolean_function.h"
#include "hal_core/netlist/gate.h"
Expand Down Expand Up @@ -221,6 +222,11 @@ namespace hal
"saleae_file.cpp",
m_design_name + ".v"};

if (strlen(path_to_verilator_executable))
{
retval[0] = path_to_verilator_executable + std::string("verilator");
}

if (!m_compiler.empty())
{
retval.push_back("--compiler");
Expand Down

0 comments on commit c5809ed

Please sign in to comment.