2017-04-12 05:03:34 +02:00
|
|
|
// See LICENSE.SiFive for license details.
|
|
|
|
|
|
|
|
#include <vpi_user.h>
|
|
|
|
#include <svdpi.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include "remote_bitbang.h"
|
|
|
|
|
|
|
|
remote_bitbang_t* jtag;
|
|
|
|
|
|
|
|
extern "C" int jtag_tick
|
|
|
|
(
|
|
|
|
unsigned char * jtag_TCK,
|
|
|
|
unsigned char * jtag_TMS,
|
|
|
|
unsigned char * jtag_TDI,
|
|
|
|
unsigned char * jtag_TRSTn,
|
|
|
|
unsigned char jtag_TDO
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (!jtag) {
|
|
|
|
s_vpi_vlog_info info;
|
|
|
|
if (!vpi_get_vlog_info(&info)) {
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
// TODO: Pass in real port number
|
|
|
|
jtag = new remote_bitbang_t(0);
|
|
|
|
}
|
2017-12-19 23:57:31 +01:00
|
|
|
|
2017-04-12 05:03:34 +02:00
|
|
|
jtag->tick(jtag_TCK, jtag_TMS, jtag_TDI, jtag_TRSTn, jtag_TDO);
|
2017-12-19 23:57:31 +01:00
|
|
|
|
2017-04-12 05:03:34 +02:00
|
|
|
return jtag->done() ? (jtag->exit_code() << 1 | 1) : 0;
|
|
|
|
|
|
|
|
}
|