SILICON
Toggle main menu visibility
Loading...
Searching...
No Matches
tests.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <cassert>
3
#include <
core/gates.hpp
>
4
#include <
core/wire.hpp
>
5
#include <gtest/gtest.h>
6
#include <memory>
7
#include <
utils/num_formatting.hpp
>
8
9
using namespace
SILICON::core
;
10
11
inline
BusValue
valueFor
(
const
Bus
& bus,
const
std::uint64_t value)
12
{
13
return
busValueFromInteger
(value, bus.
size
());
14
}
15
16
inline
BusValue
valueFor
(
const
std::size_t width,
const
std::uint64_t value)
17
{
18
return
busValueFromInteger
(value, width);
19
}
20
21
extern
"C"
{
22
inline
void
__ubsan_on_report
()
23
{
24
FAIL() <<
"Encountered an undefined behavior sanitizer error"
;
25
}
26
27
inline
void
__asan_on_error
()
28
{
29
FAIL() <<
"Encountered an address sanitizer error"
;
30
}
31
32
inline
void
__tsan_on_report
()
33
{
34
FAIL() <<
"Encountered a thread sanitizer error"
;
35
}
36
}
// extern "C"
37
38
inline
void
PrintTo
(
const
State
& s, std::ostream* os)
39
{
40
switch
(s) {
41
case
State::HIGH
: *os <<
"HIGH"
;
break
;
42
case
State::LOW
: *os <<
"LOW"
;
break
;
43
case
State::ERROR
: *os <<
"ERROR"
;
break
;
44
case
State::UNKNOWN
: *os <<
"UNKNOWN"
;
break
;
45
default
: assert(
false
);
46
}
47
}
SILICON::core::Bus
Definition
wire.hpp:138
SILICON::core::Bus::size
auto size()
Definition
wire.hpp:183
gates.hpp
SILICON::core
Definition
activeKeyGuard.hpp:28
SILICON::core::busValueFromInteger
BusValue busValueFromInteger(const BigInt &value, const std::size_t width)
Builds an LSB-first BusValue from the low width bits of an integer. Negative values use two's complem...
Definition
num_formatting.cpp:257
SILICON::core::State
State
Definition
wire.hpp:37
SILICON::core::State::LOW
@ LOW
Definition
wire.hpp:38
SILICON::core::State::UNKNOWN
@ UNKNOWN
Definition
wire.hpp:40
SILICON::core::State::HIGH
@ HIGH
Definition
wire.hpp:39
SILICON::core::State::ERROR
@ ERROR
Definition
wire.hpp:41
SILICON::core::BusValue
std::vector< State > BusValue
Definition
wire.hpp:120
num_formatting.hpp
__asan_on_error
void __asan_on_error()
Definition
tests.hpp:27
PrintTo
void PrintTo(const State &s, std::ostream *os)
Definition
tests.hpp:38
__tsan_on_report
void __tsan_on_report()
Definition
tests.hpp:32
valueFor
BusValue valueFor(const Bus &bus, const std::uint64_t value)
Definition
tests.hpp:11
__ubsan_on_report
void __ubsan_on_report()
Definition
tests.hpp:22
wire.hpp
tests
tests.hpp
Generated by
1.17.0