Belle II Software
release-08-01-10
|
Helper class for software (C++) / firmware (VHDL) co-simulation. More...
Functions | |
std::string | display_value (const char *count, int size) |
Display value of the signal. | |
template<size_t N> | |
std::string | slv_to_bin_string (std::array< char, N > signal, bool padding=false) |
Transform into string. | |
template<size_t N> | |
void | display_hex (const std::array< char, N > &signal) |
Display signal in hex. | |
template<size_t N> | |
void | display_nonzero_hex (const std::array< char, N > &signal) |
Display nonzero value of signal in hex. | |
template<size_t nbits, size_t min, size_t max> | |
std::bitset< max - min+1 > | subset (std::bitset< nbits > set) |
extract a subset of bitstring, like substring. More... | |
Variables | |
const char * | std_logic_literal [] = {"U", "X", "0", "1", "Z", "W", "L", "H", "-"} |
In case you are not familiar with VHDL simulation, there are 9 possible values defined for the standard logic type, instead of just 0 and 1. More... | |
const char | one_val = 3 |
'1' in XSI VHDL simulation | |
const char | zero_val = 2 |
'0' in XSI VHDL simulation | |
Helper class for software (C++) / firmware (VHDL) co-simulation.
std::bitset< max - min + 1 > Cosim::subset | ( | std::bitset< nbits > | set | ) |
extract a subset of bitstring, like substring.
In principle this can be done using only integer manipulations, but for the sake of simplicity, let's just cast them to string. Beware the endianness. 0 refer to the rightmost bit in std::bitset, but the leftmost bit in std::string
const char* std_logic_literal[] = {"U", "X", "0", "1", "Z", "W", "L", "H", "-"} |
In case you are not familiar with VHDL simulation, there are 9 possible values defined for the standard logic type, instead of just 0 and 1.
The simulator needs to compute all these possible outcomes. Therefore, XSI uses a byte, instead of a bit, to represent a std_logic. This is represented with a char with possible values ranging from 0 to 8.