clang-format of test_regress. No functional change.

This commit is contained in:
Wilson Snyder 2020-10-28 18:42:36 -04:00
parent f670eccf8c
commit 0c328b6eaf
35 changed files with 109 additions and 39 deletions

View File

@ -462,11 +462,12 @@ analyzer-include:
CLANGFORMAT = clang-format
CLANGFORMAT_FLAGS = -i
CLANGFORMAT_FILES = $(CPPCHECK_CPP) $(CPPCHECK_H) $(CPPCHECK_YL) test_regress/t/*.c*
clang-format:
@$(CLANGFORMAT) --version | egrep 10.0 > /dev/null \
|| echo "*** You are not using clang-format 10.0, indents may differ from master's ***"
$(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CPPCHECK_CPP) $(CPPCHECK_H) $(CPPCHECK_YL)
$(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CLANGFORMAT_FILES)
ftp: info

View File

@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
// clang-format off
#if defined(NCSC)
// Used by NC's svdpi.h to pick up svLogicVecVal with _.aval and _.bval fields,
// rather than the IEEE 1800-2005 version which has _.a and _.b fields.
@ -46,6 +47,7 @@ typedef uint64_t sv_longint_unsigned_t;
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
//======================================================================
// Implementations of imported functions

View File

@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
// clang-format off
#if defined(NCSC)
// Used by NC's svdpi.h to pick up svLogicVecVal with _.aval and _.bval fields,
// rather than the IEEE 1800-2005 version which has _.a and _.b fields.
@ -51,6 +52,7 @@ typedef uint64_t sv_longint_unsigned_t;
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
//======================================================================
// Implementations of imported functions

View File

@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
// clang-format off
#if defined(NCSC)
// Used by NC's svdpi.h to pick up svLogicVecVal with _.aval and _.bval fields,
// rather than the IEEE 1800-2005 version which has _.a and _.b fields.
@ -46,6 +47,7 @@ typedef uint64_t sv_longint_unsigned_t;
# else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
//======================================================================
// Implementations of imported functions

View File

@ -14,6 +14,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# ifdef T_DPI_CONTEXT_NOOPT
# include "Vt_dpi_context_noopt__Dpi.h"
@ -31,6 +32,7 @@
#ifdef VERILATOR
# include "verilated.h"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {
@ -126,7 +128,7 @@ int dpic_restore() {
unsigned dpic_getcontext() {
svScope scope = svGetScope();
printf("%%Info: svGetScope returned scope (%p) with name %s\n",
printf("%%Info: svGetScope returned scope (%p) with name %s\n", //
scope, svGetNameFromScope(scope));
return (unsigned)(uintptr_t)scope;
}

View File

@ -14,6 +14,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_display__Dpi.h"
#elif defined(VCS)
@ -23,6 +24,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {
@ -31,12 +33,12 @@ extern void dpii_display_call(const char* c);
}
#endif
// clang-format off
#ifndef VL_PRINTF
# define VL_PRINTF printf
#endif
// clang-format on
//======================================================================
void dpii_display_call(const char* c) {
VL_PRINTF("dpii_display_call: '%s'\n", c);
}
void dpii_display_call(const char* c) { VL_PRINTF("dpii_display_call: '%s'\n", c); }

View File

@ -13,6 +13,7 @@
#include <cstring>
#include "svdpi.h"
// clang-format off
#ifdef _WIN32
# define T_PRI64 "I64"
#else // Linux or compliant Unix flavors
@ -34,6 +35,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
@ -67,6 +69,7 @@ extern void dpix_t_time(const svLogicVecVal* i, svLogicVecVal* o);
//======================================================================
// clang-format off
#define CHECK_RESULT(type, got, exp) \
if ((got) != (exp)) { \
printf("%%Error: %s:%d:", __FILE__, __LINE__); \
@ -77,6 +80,7 @@ extern void dpix_t_time(const svLogicVecVal* i, svLogicVecVal* o);
printf(" EXP = %" T_PRI64 "x\n", u.l); \
return __LINE__; \
}
// clang-format on
#define CHECK_RESULT_NNULL(got) \
if (!(got)) { \
printf("%%Error: %s:%d: GOT = %p EXP = !NULL\n", __FILE__, __LINE__, (got)); \
@ -183,7 +187,9 @@ int dpix_run_tests() {
CHECK_RESULT(svLogic, o, 0);
}
{
svLogicVecVal i[1]; i[0].aval = 0x12; i[0].bval = 0;
svLogicVecVal i[1];
i[0].aval = 0x12;
i[0].bval = 0;
svLogicVecVal o[1];
dpix_t_reg15(i, o);
CHECK_RESULT(int, o[0].aval, (~i[0].aval) & 0x7fff);
@ -191,9 +197,12 @@ int dpix_run_tests() {
}
{
svLogicVecVal i[3];
i[0].aval = 0x72912312; i[0].bval = 0;
i[1].aval = 0xab782a12; i[1].bval = 0;
i[2].aval = 0x8a413bd9; i[2].bval = 0;
i[0].aval = 0x72912312;
i[0].bval = 0;
i[1].aval = 0xab782a12;
i[1].bval = 0;
i[2].aval = 0x8a413bd9;
i[2].bval = 0;
svLogicVecVal o[3];
dpix_t_reg95(i, o);
CHECK_RESULT(int, o[0].aval, ~i[0].aval);
@ -206,8 +215,10 @@ int dpix_run_tests() {
#if !defined(VCS) && !defined(CADENCE)
{
svLogicVecVal i[2];
i[0].aval = 0x72912312; i[0].bval = 0;
i[1].aval = 0xab782a12; i[1].bval = 0;
i[0].aval = 0x72912312;
i[0].bval = 0;
i[1].aval = 0xab782a12;
i[1].bval = 0;
svLogicVecVal o[2];
dpix_t_time(i, o);
CHECK_RESULT(int, o[0].aval, ~i[0].aval);

View File

@ -11,6 +11,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_export_context_bad__Dpi.h"
#elif defined(VCS)
@ -20,6 +21,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -15,6 +15,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_imp_gen__Dpi.h"
#elif defined(VCS)
@ -24,6 +25,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -15,6 +15,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_import__Dpi.h"
#elif defined(VCS)
@ -24,6 +25,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
typedef struct {
int a;

View File

@ -16,6 +16,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_lib__Dpi.h"
#elif defined(VCS)
@ -25,6 +26,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -16,6 +16,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_open__Dpi.h"
#elif defined(VCS)
@ -27,6 +28,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {
@ -90,11 +92,13 @@ extern int dpii_failure();
int failure = 0;
int dpii_failure() { return failure; }
// clang-format off
#ifdef _WIN32
# define T_PRI64 "I64"
#else // Linux or compliant Unix flavors
# define T_PRI64 "ll"
#endif
// clang-format on
#define CHECK_RESULT_HEX(got, exp) \
do { \

View File

@ -9,10 +9,9 @@
//
//*************************************************************************
// clang-format off
#include "svdpi.h"
// clang-format off
#if defined(VERILATOR) // Verilator
# include "Vt_dpi_open_query__Dpi.h"
#elif defined(VCS) // VCS
@ -24,7 +23,6 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
//======================================================================

View File

@ -16,6 +16,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_openfirst__Dpi.h"
#elif defined(VCS)
@ -25,6 +26,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -23,6 +23,7 @@
void poke_value(int i) {
printf("poke_value(%d)\n", i);
// clang-format off
#ifdef VERILATOR
static int didDump = 0;
if (didDump++ == 0) {
@ -31,6 +32,7 @@ void poke_value(int i) {
# endif
}
#endif
// clang-format on
svScope scope = svGetScopeFromName("top.t.a");
if (scope == NULL) {

View File

@ -15,6 +15,7 @@
#include "svdpi.h"
// clang-format off
#if defined(VERILATOR) // Verilator
# include "Vt_dpi_result_type__Dpi.h"
typedef long long sv_longint_t;
@ -41,6 +42,7 @@ typedef uint64_t sv_longint_unsigned_t;
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
//======================================================================
// Implementations of imported functions

View File

@ -15,6 +15,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# if defined(T_DPI_SHORTCIRCUIT)
# include "Vt_dpi_shortcircuit__Dpi.h"
@ -30,6 +31,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -15,6 +15,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_string__Dpi.h"
#elif defined(VCS)
@ -24,6 +25,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -14,6 +14,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_sys__Dpi.h"
#elif defined(VCS)
@ -23,6 +24,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -17,6 +17,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# ifdef T_DPI_THREADS_COLLIDE
# include "Vt_dpi_threads_collide__Dpi.h"
@ -30,6 +31,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -11,6 +11,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_dpi_vams__Dpi.h"
#elif defined(VCS)
@ -20,6 +21,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#ifdef NEED_EXTERNS
extern "C" {

View File

@ -120,11 +120,13 @@ int main(int argc, char** argv, char** env) {
VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out
// clang-format off
#ifdef VERILATOR
# ifdef TEST_VERBOSE
Verilated::scopesDump();
# endif
#endif
// clang-format on
topp->eval();
topp->clk = 0;

View File

@ -16,6 +16,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_embed1__Dpi.h"
#elif defined(VCS)
@ -25,6 +26,7 @@
#else
# error "Unknown simulator for DPI test"
#endif
// clang-format on
#include "verilated.h"
@ -80,14 +82,9 @@ void t_embed_child_eval() {
__modelp->eval();
}
void t_embed_child_io_eval(unsigned char clk,
unsigned char bit_in,
const svBitVecVal* vec_in,
const svBitVecVal* wide_in,
unsigned char is_ref,
unsigned char* bit_out,
svBitVecVal* vec_out,
svBitVecVal* wide_out,
void t_embed_child_io_eval(unsigned char clk, unsigned char bit_in, const svBitVecVal* vec_in,
const svBitVecVal* wide_in, unsigned char is_ref,
unsigned char* bit_out, svBitVecVal* vec_out, svBitVecVal* wide_out,
unsigned char* did_init_out) {
VL_DEBUG_IF(VL_PRINTF(" t_embed1_child_io_eval\n"););
Vt_embed1_child* __modelp = __get_modelp();

View File

@ -14,6 +14,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# include "Vt_flag_ldflags__Dpi.h"
#else
@ -28,5 +29,6 @@
#ifndef CFLAGS2_FROM_CMDLINE
# error "CFLAGS2_FROM_CMDLINE not set - not passed down?"
#endif
// clang-format on
void dpii_c_library() {}

View File

@ -30,13 +30,12 @@ long long get_memory_usage() {
int ps_ign;
vluint64_t ps_vsize, ps_rss;
int items = fscanf(fp, ("%d (%*[^) ]) %*1s %d %*d %*d %*d %*d %u"
int items = fscanf(fp,
("%d (%*[^) ]) %*1s %d %*d %*d %*d %*d %u"
" %u %u %u %u %d %d %d %d"
" %*d %*d %*u %*u %d %" VL_PRI64 "u %" VL_PRI64 "u "),
&ps_ign, &ps_ign, &ps_ign,
&ps_ign, &ps_ign, &ps_ign, &ps_ign,
&ps_ign, &ps_ign, &ps_ign, &ps_ign,
&ps_ign, &ps_vsize, &ps_rss);
&ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_ign,
&ps_ign, &ps_ign, &ps_ign, &ps_ign, &ps_vsize, &ps_rss);
fclose(fp);
if (items >= 14) {
return ps_vsize;

View File

@ -48,6 +48,7 @@ int main()
#endif
// loop through every possibility and check the result
// clang-format off
#ifdef SYSTEMC_VERSION
sc_start(1, SC_NS);
# define ASSIGN(s, v) s.write(v)
@ -57,6 +58,7 @@ int main()
# define ASSIGN(s, v) tb->s = (v)
# define READ(s) tb->s
#endif
// clang-format on
ASSIGN(i3, 13);
for (int i = 0; i < 4; i++) {

View File

@ -46,9 +46,9 @@ int main(int argc, char* argv[]) {
Verilated::debug(0);
/* clear all bits in the array */
// clear all bits in the array
for (slot = 0; slot < 3; slot++)
for (bit = 0; bit < 2; bit++)
for (bit = 0; bit < 2; bit++) //
StepSim(sim, slot, bit, 0, 0);
printf("\nTesting\n");

View File

@ -15,6 +15,7 @@
//======================================================================
// clang-format off
#if defined(VERILATOR)
# ifdef T_PROTECT_IDS_KEY
# include "Vt_protect_ids_key__Dpi.h"
@ -32,6 +33,7 @@
#ifdef NEED_EXTERNS
# error "Not supported"
#endif
// clang-format on
//======================================================================

View File

@ -9,6 +9,7 @@
#include <verilated.h>
#include <verilated_vcd_c.h>
// clang-format off
#include VM_PREFIX_INCLUDE
#ifdef T_TRACE_PUBLIC_FUNC_VLT
# include "Vt_trace_public_func_vlt_t.h"
@ -17,6 +18,7 @@
# include "Vt_trace_public_func_t.h"
# include "Vt_trace_public_func_glbl.h"
#endif
// clang-format on
unsigned long long main_time = 0;
double sc_time_stamp() { return (double)main_time; }

View File

@ -9,6 +9,7 @@
#include <verilated.h>
#include <verilated_vcd_c.h>
// clang-format off
#include VM_PREFIX_INCLUDE
#ifdef T_TRACE_PUBLIC_SIG_VLT
# include "Vt_trace_public_sig_vlt_t.h"
@ -17,6 +18,7 @@
# include "Vt_trace_public_sig_t.h"
# include "Vt_trace_public_sig_glbl.h"
#endif
// clang-format on
unsigned long long main_time = 0;
double sc_time_stamp() { return (double)main_time; }

View File

@ -6,6 +6,7 @@
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// clang-format off
#include "verilatedos.h"
#include VM_PREFIX_INCLUDE
#include "Vt_trace_two_b.h"
@ -17,6 +18,7 @@
# include "verilated_vcd_c.h"
# endif
#endif
// clang-format on
// Compile in place
#include "Vt_trace_two_b.cpp"
@ -39,6 +41,7 @@ int main(int argc, char** argv, char** env) {
ap = new VM_PREFIX("topa");
bp = new Vt_trace_two_b("topb");
// clang-format off
#ifdef TEST_HDR_TRACE
Verilated::traceEverOn(true);
# ifdef TEST_FST
@ -53,6 +56,7 @@ int main(int argc, char** argv, char** env) {
tfp->open(VL_STRINGIFY(TEST_OBJ_DIR) "/simx.vcd");
# endif
#endif
// clang-format on
#ifdef TEST_HDR_TRACE
ap->eval_step();

View File

@ -6,6 +6,7 @@
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
// clang-format off
#include "verilatedos.h"
#include VM_PREFIX_INCLUDE
#include "Vt_trace_two_b.h"
@ -13,6 +14,7 @@
#ifdef TEST_HDR_TRACE
# include "verilated_vcd_sc.h"
#endif
// clang-format on
// Compile in place
#include "Vt_trace_two_b.cpp"

View File

@ -167,7 +167,9 @@ static int _end_of_sim_cb(p_cb_data cb_data) {
extern "C"
#endif
// clang-format off
void vpi_compat_bootstrap(void) {
// clang-format on
t_cb_data cb_data;
bzero(&cb_data, sizeof(cb_data));
@ -197,11 +199,13 @@ int main(int argc, char** argv, char** env) {
VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out
// clang-format off
#ifdef VERILATOR
# ifdef TEST_VERBOSE
Verilated::scopesDump();
# endif
#endif
// clang-format on
#if VM_TRACE
Verilated::traceEverOn(true);

View File

@ -117,7 +117,9 @@ static int _end_of_sim_cb(p_cb_data cb_data) {
extern "C"
#endif
// clang-format off
void vpi_compat_bootstrap(void) {
// clang-format on
t_cb_data cb_data;
bzero(&cb_data, sizeof(cb_data));
@ -147,11 +149,13 @@ int main(int argc, char** argv, char** env) {
VM_PREFIX* topp = new VM_PREFIX(""); // Note null name - we're flattening it out
// clang-format off
#ifdef VERILATOR
# ifdef TEST_VERBOSE
Verilated::scopesDump();
# endif
#endif
// clang-format on
#if VM_TRACE
Verilated::traceEverOn(true);