2012-04-13 03:08:20 +02:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2006-08-26 13:35:28 +02:00
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Configure source; system configuration
|
|
|
|
|
//
|
2008-06-10 03:25:10 +02:00
|
|
|
// This file is part of Verilator.
|
2006-08-26 13:35:28 +02:00
|
|
|
//
|
2019-11-08 04:33:59 +01:00
|
|
|
// Code available from: https://verilator.org
|
2006-08-26 13:35:28 +02:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2023-01-01 16:18:39 +01:00
|
|
|
// Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
2020-03-21 16:24:24 +01:00
|
|
|
// can redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 23:07:57 +02:00
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2008-06-10 03:25:10 +02:00
|
|
|
//
|
2006-08-26 13:35:28 +02:00
|
|
|
//*************************************************************************
|
2019-10-05 02:17:11 +02:00
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Version and host name
|
|
|
|
|
|
2011-10-05 15:50:14 +02:00
|
|
|
// Autoconf substitutes this with the strings from AC_INIT.
|
|
|
|
|
#define PACKAGE_STRING ""
|
|
|
|
|
|
2021-04-18 16:16:18 +02:00
|
|
|
#define PACKAGE_VERSION_NUMBER_STRING "0.000"
|
|
|
|
|
|
2017-10-10 13:18:01 +02:00
|
|
|
#define DTVERSION PACKAGE_STRING
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Functions
|
2010-12-18 01:40:08 +01:00
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Headers
|
2010-12-18 01:40:08 +01:00
|
|
|
|
2008-03-18 21:26:37 +01:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Default environment
|
|
|
|
|
|
|
|
|
|
// Set defines to defaults for environment variables
|
|
|
|
|
// If set to "", this default is ignored and the user is expected
|
|
|
|
|
// to set them at Verilator runtime.
|
|
|
|
|
|
2020-04-14 04:51:35 +02:00
|
|
|
// clang-format off
|
2008-03-18 21:26:37 +01:00
|
|
|
#ifndef DEFENV_SYSTEMC
|
|
|
|
|
# define DEFENV_SYSTEMC ""
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef DEFENV_SYSTEMC_ARCH
|
|
|
|
|
# define DEFENV_SYSTEMC_ARCH ""
|
|
|
|
|
#endif
|
2012-01-20 02:30:41 +01:00
|
|
|
#ifndef DEFENV_SYSTEMC_INCLUDE
|
|
|
|
|
# define DEFENV_SYSTEMC_INCLUDE ""
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef DEFENV_SYSTEMC_LIBDIR
|
|
|
|
|
# define DEFENV_SYSTEMC_LIBDIR ""
|
|
|
|
|
#endif
|
2008-03-18 21:26:37 +01:00
|
|
|
#ifndef DEFENV_VERILATOR_ROOT
|
|
|
|
|
# define DEFENV_VERILATOR_ROOT ""
|
|
|
|
|
#endif
|
2020-04-14 04:51:35 +02:00
|
|
|
// clang-format on
|
2008-03-18 21:26:37 +01:00
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Compile options
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <iostream>
|
2008-05-28 21:58:18 +02:00
|
|
|
#include <cstdlib>
|
2008-06-30 19:11:25 +02:00
|
|
|
#include <cstdio>
|
2008-10-15 16:49:05 +02:00
|
|
|
#include <cstring>
|
2018-02-02 03:24:41 +01:00
|
|
|
#include <string>
|
|
|
|
|
#include <iostream>
|
2006-08-26 13:35:28 +02:00
|
|
|
|
2018-02-02 03:24:41 +01:00
|
|
|
// Avoid needing std:: prefixes on some very common items
|
2021-03-13 00:10:45 +01:00
|
|
|
using string = std::string;
|
2018-02-02 03:24:41 +01:00
|
|
|
using std::cout;
|
|
|
|
|
using std::endl;
|
2006-08-26 13:35:28 +02:00
|
|
|
|
2017-10-14 15:00:39 +02:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** Configure-discovered library options
|
|
|
|
|
|
|
|
|
|
// Define if struct stat has st_mtim.tv_nsec (from configure)
|
|
|
|
|
#undef HAVE_STAT_NSEC
|
2020-05-29 00:51:46 +02:00
|
|
|
// Define if SystemC found
|
|
|
|
|
// - If defined, the default search path has it, so support is always enabled.
|
|
|
|
|
// - If undef, not system-wide, user can set SYSTEMC_INCLUDE.
|
2020-06-28 18:17:54 +02:00
|
|
|
#undef HAVE_SYSTEMC
|
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.
Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).
The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.
There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
for suspending a stack of coroutines (normally, C++ coroutines are
stackless).
There is a new visitor in `V3Timing.cpp` which:
* scales delays according to the timescale,
* simplifies intra-assignment timing controls and net delays into
regular timing controls and assignments,
* simplifies wait statements into loops with event controls,
* marks processes and tasks with timing controls in them as
suspendable,
* creates delay, trigger scheduler, and fork sync variables,
* transforms timing controls and fork joins into C++ awaits
There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.
There is also a function that transforms forked processes into separate
functions.
See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 14:26:32 +02:00
|
|
|
#undef HAVE_COROUTINES
|
2017-10-14 15:00:39 +02:00
|
|
|
|
2006-08-26 13:35:28 +02:00
|
|
|
//**********************************************************************
|
|
|
|
|
//**** OS and compiler specifics
|
|
|
|
|
|
|
|
|
|
#include "verilatedos.h"
|
2018-06-29 00:55:36 +02:00
|
|
|
|
|
|
|
|
//**********************************************************************
|
|
|
|
|
//**** This file sometimes gets truncated, so check in consumers
|
|
|
|
|
#define HAVE_CONFIG_BUILD
|