[bridges] Disambiguate between printf bridge drivers

This commit is contained in:
David Biancolin 2020-03-03 17:09:39 -08:00
parent 32eb41f289
commit 23b87ae9f8
3 changed files with 19 additions and 14 deletions

View File

@ -15,7 +15,8 @@ synthesized_prints_t::synthesized_prints_t(
const char* const* format_strings,
const unsigned int* argument_counts,
const unsigned int* argument_widths,
unsigned int dma_address):
unsigned int dma_address,
int printno) :
bridge_driver_t(sim),
mmio_addrs(mmio_addrs),
print_count(print_count),
@ -25,7 +26,8 @@ synthesized_prints_t::synthesized_prints_t(
format_strings(format_strings),
argument_counts(argument_counts),
argument_widths(argument_widths),
dma_address(dma_address) {
dma_address(dma_address),
printno(printno) {
assert((token_bytes & (token_bytes - 1)) == 0);
assert(print_count > 0);
@ -34,9 +36,10 @@ synthesized_prints_t::synthesized_prints_t(
this->start_cycle = 0;
this->end_cycle = -1ULL;
std::string printfile_arg = std::string("+print-file=");
std::string printstart_arg = std::string("+print-start=");
std::string printend_arg = std::string("+print-end=");
std::string num_equals = std::to_string(printno) + std::string("=");
std::string printfile_arg = std::string("+print-file") + num_equals;
std::string printstart_arg = std::string("+print-start") + num_equals;
std::string printend_arg = std::string("+print-end") + num_equals;
// Does not format the printfs, before writing them to file
std::string binary_arg = std::string("+print-binary");
// Removes the cycle prefix from human-readable output

View File

@ -34,7 +34,8 @@ class synthesized_prints_t: public bridge_driver_t
const char* const* format_strings,
const unsigned int* argument_counts,
const unsigned int* argument_widths,
unsigned int dma_address);
unsigned int dma_address,
int printno);
~synthesized_prints_t();
virtual void init();
virtual void tick();
@ -52,6 +53,7 @@ class synthesized_prints_t: public bridge_driver_t
const unsigned int* argument_counts;
const unsigned int* argument_widths;
const unsigned int dma_address;
const int printno;
// DMA batching parameters
const size_t beat_bytes = DMA_DATA_BITS / 8;

View File

@ -554,7 +554,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_0_format_strings,
PRINTBRIDGEMODULE_0_argument_counts,
PRINTBRIDGEMODULE_0_argument_widths,
PRINTBRIDGEMODULE_0_DMA_ADDR));
PRINTBRIDGEMODULE_0_DMA_ADDR, 0));
#endif
#ifdef PRINTBRIDGEMODULE_1_PRESENT
PRINTBRIDGEMODULE_1_substruct_create;
@ -568,7 +568,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_1_format_strings,
PRINTBRIDGEMODULE_1_argument_counts,
PRINTBRIDGEMODULE_1_argument_widths,
PRINTBRIDGEMODULE_1_DMA_ADDR));
PRINTBRIDGEMODULE_1_DMA_ADDR, 1));
#endif
#ifdef PRINTBRIDGEMODULE_2_PRESENT
PRINTBRIDGEMODULE_2_substruct_create;
@ -582,7 +582,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_2_format_strings,
PRINTBRIDGEMODULE_2_argument_counts,
PRINTBRIDGEMODULE_2_argument_widths,
PRINTBRIDGEMODULE_2_DMA_ADDR));
PRINTBRIDGEMODULE_2_DMA_ADDR, 2));
#endif
#ifdef PRINTBRIDGEMODULE_3_PRESENT
PRINTBRIDGEMODULE_3_substruct_create;
@ -596,7 +596,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_3_format_strings,
PRINTBRIDGEMODULE_3_argument_counts,
PRINTBRIDGEMODULE_3_argument_widths,
PRINTBRIDGEMODULE_3_DMA_ADDR));
PRINTBRIDGEMODULE_3_DMA_ADDR, 3));
#endif
#ifdef PRINTBRIDGEMODULE_4_PRESENT
PRINTBRIDGEMODULE_4_substruct_create;
@ -610,7 +610,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_4_format_strings,
PRINTBRIDGEMODULE_4_argument_counts,
PRINTBRIDGEMODULE_4_argument_widths,
PRINTBRIDGEMODULE_4_DMA_ADDR));
PRINTBRIDGEMODULE_4_DMA_ADDR, 4));
#endif
#ifdef PRINTBRIDGEMODULE_5_PRESENT
PRINTBRIDGEMODULE_5_substruct_create;
@ -624,7 +624,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_5_format_strings,
PRINTBRIDGEMODULE_5_argument_counts,
PRINTBRIDGEMODULE_5_argument_widths,
PRINTBRIDGEMODULE_5_DMA_ADDR));
PRINTBRIDGEMODULE_5_DMA_ADDR, 5));
#endif
#ifdef PRINTBRIDGEMODULE_6_PRESENT
PRINTBRIDGEMODULE_6_substruct_create;
@ -638,7 +638,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_6_format_strings,
PRINTBRIDGEMODULE_6_argument_counts,
PRINTBRIDGEMODULE_6_argument_widths,
PRINTBRIDGEMODULE_6_DMA_ADDR));
PRINTBRIDGEMODULE_6_DMA_ADDR, 6));
#endif
#ifdef PRINTBRIDGEMODULE_7_PRESENT
PRINTBRIDGEMODULE_7_substruct_create;
@ -652,7 +652,7 @@ uint64_t host_mem_offset = -0x80000000LL;
PRINTBRIDGEMODULE_7_format_strings,
PRINTBRIDGEMODULE_7_argument_counts,
PRINTBRIDGEMODULE_7_argument_widths,
PRINTBRIDGEMODULE_7_DMA_ADDR));
PRINTBRIDGEMODULE_7_DMA_ADDR, 7));
#endif
// Add functions you'd like to periodically invoke on a paused simulator here.
if (profile_interval != -1) {