adding stream arbiter

This commit is contained in:
Blaise Tine
2020-12-03 06:40:23 -08:00
parent f575f16f57
commit f3b1069ce8
33 changed files with 717 additions and 745 deletions

View File

@@ -21,6 +21,7 @@ extern "C" {
void dpi_ftou(int inst, bool enable, int a, int* result);
void dpi_itof(int inst, bool enable, int a, int* result);
void dpi_utof(int inst, bool enable, int a, int* result);
void dpi_delayed_assert(int inst, bool cond);
}
class ShiftRegister {
@@ -238,4 +239,17 @@ void dpi_utof(int inst, bool enable, int a, int* result) {
sr.ensure_init(LATENCY_ITOF);
sr.push(fr.i, enable);
*result = sr.top();
}
void dpi_delayed_assert(int inst, bool cond) {
ShiftRegister& sr = instances.get(inst);
sr.ensure_init(2);
sr.push(!cond, 1);
auto status = sr.top();
if (status) {
printf("delayed assertion at %s!\n", svGetNameFromScope(svGetScope()));
std::abort();
}
}

View File

@@ -15,4 +15,6 @@ import "DPI-C" context function void dpi_ftou(int inst, input logic enable, inpu
import "DPI-C" context function void dpi_itof(int inst, input logic enable, input int a, output int result);
import "DPI-C" context function void dpi_utof(int inst, input logic enable, input int a, output int result);
import "DPI-C" context function void dpi_delayed_assert(int inst, input logic cond);
`endif