File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1010#include < exception>
1111#include < thread>
1212#include < chrono>
13+ #include < cmath>
1314
1415// External global variables (defined in vpi_module.cpp)
1516extern spice_vpi::TimeBarrier<unsigned long long > g_time_barrier;
@@ -148,7 +149,7 @@ auto vpi_start_of_sim_cb(p_cb_data cb_data_p) -> PLI_INT32 {
148149 try {
149150 // Load configuration from environment variables
150151 g_config = spice_vpi::Config::load_from_environment ();
151-
152+
152153 // Initialize the interface with the configuration
153154 g_interface = std::make_unique<spice_vpi::AnalogDigitalInterface>(g_config);
154155
@@ -171,6 +172,11 @@ auto vpi_start_of_sim_cb(p_cb_data cb_data_p) -> PLI_INT32 {
171172 vpi_printf (" ** Info: Using logic thresholds: LOGIC_THRESHOLD_LOW=%g, LOGIC_THRESHOLD_HIGH=%g\n " ,
172173 g_config.logic_threshold_low , g_config.logic_threshold_high );
173174
175+ int time_unit = vpi_get (vpiTimeUnit, nullptr );
176+ int time_precision = vpi_get (vpiTimePrecision, nullptr );
177+ g_config.time_precision = static_cast <unsigned long long >(std::pow (10 , -time_precision));
178+ vpi_printf (" ** Info: Simulation precision: %lld (10e%d)\n " , g_config.time_precision , time_precision);
179+
174180 } catch (const std::exception& e) {
175181 ERROR (" Configuration error: %s" , e.what ());
176182 return 1 ;
You can’t perform that action at this time.
0 commit comments