mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-24 22:07:41 -04:00
scope_tap bug fixes and improvements
This commit is contained in:
parent
0e3206747a
commit
4f11278d2c
17 changed files with 312 additions and 276 deletions
|
@ -32,6 +32,8 @@
|
|||
|
||||
#define TIMEOUT_TIME (60*60)
|
||||
|
||||
#define MAX_DELAY_CYCLES 10000
|
||||
|
||||
#define MMIO_SCOPE_READ (AFU_IMAGE_MMIO_SCOPE_READ * 4)
|
||||
#define MMIO_SCOPE_WRITE (AFU_IMAGE_MMIO_SCOPE_WRITE * 4)
|
||||
|
||||
|
@ -41,6 +43,7 @@
|
|||
#define CMD_GET_DATA 3
|
||||
#define CMD_SET_START 4
|
||||
#define CMD_SET_STOP 5
|
||||
#define CMD_SET_DEPTH 6
|
||||
|
||||
#define CHECK_ERR(_expr) \
|
||||
do { \
|
||||
|
@ -96,7 +99,7 @@ static void dump_module(std::ofstream& ofs,
|
|||
auto itt = tails.find(name);
|
||||
if (itt != tails.end()) {
|
||||
for (auto& signal : itt->second->signals) {
|
||||
ofs << indent << " $var reg " << signal.width << " " << signal.id << " " << signal.name << " $end" << std::endl;
|
||||
ofs << indent << " $var wire " << signal.width << " " << signal.id << " " << signal.name << " $end" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +117,7 @@ static void dump_header(std::ofstream& ofs, std::vector<tap_t>& taps) {
|
|||
ofs << "$version Generated by Vortex Scope Analyzer $end" << std::endl;
|
||||
ofs << "$timescale 1 ns $end" << std::endl;
|
||||
ofs << "$scope module TOP $end" << std::endl;
|
||||
ofs << " $var reg 1 0 clk $end" << std::endl;
|
||||
ofs << " $var wire 1 0 clk $end" << std::endl;
|
||||
|
||||
std::unordered_map<std::string, std::unordered_set<std::string>> hierarchy;
|
||||
std::unordered_set<std::string> heads;
|
||||
|
@ -160,6 +163,14 @@ static tap_t* find_earliest_tap(std::vector<tap_t>& taps) {
|
|||
}
|
||||
|
||||
static uint64_t advance_clock(std::ofstream& ofs, uint64_t cur_time, uint64_t next_time) {
|
||||
uint64_t delta = next_time - cur_time;
|
||||
if (delta > MAX_DELAY_CYCLES) {
|
||||
ofs << '#' << (cur_time * 2 + 0) << std::endl;
|
||||
ofs << "bx 0" << std::endl;
|
||||
ofs << '#' << (cur_time * 2 + 1) << std::endl;
|
||||
ofs << "bx 0" << std::endl;
|
||||
cur_time = next_time - MAX_DELAY_CYCLES;
|
||||
}
|
||||
while (cur_time < next_time) {
|
||||
ofs << '#' << (cur_time * 2 + 0) << std::endl;
|
||||
ofs << "b0 0" << std::endl;
|
||||
|
@ -350,7 +361,6 @@ int vx_scope_stop(vx_device_h hdevice) {
|
|||
uint64_t cmd_count = (tap.id << 3) | CMD_GET_COUNT;
|
||||
CHECK_ERR(g_callback.registerWrite(hdevice, cmd_count));
|
||||
CHECK_ERR(g_callback.registerRead(hdevice, &count));
|
||||
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
|
@ -385,7 +395,6 @@ int vx_scope_stop(vx_device_h hdevice) {
|
|||
uint64_t cur_time = 0;
|
||||
auto tap = find_earliest_tap(taps);
|
||||
if (tap != nullptr) {
|
||||
cur_time = (tap->cycle_time > 0) ? (tap->cycle_time-1) : 0;
|
||||
do {
|
||||
// advance clock
|
||||
cur_time = advance_clock(ofs, cur_time, tap->cycle_time);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue