Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forgot to delete hexdata #3

Open
wants to merge 8 commits into
base: verilator
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions verilator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ RTL=../rtl/pulpino_top.sv
TOP=pulpino_top
SIM=$(TOP)_sim.elf

CFLAGS=-Iobj_dir -I/usr/share/verilator/include -g3
VERICSRC=/usr/share/verilator/include/verilated_vcd_c.cpp \
/usr/share/verilator/include/verilated.cpp
CFLAGS=-Iobj_dir -I/mingw64/share/verilator/include -g3 -std=c++11
VERICSRC=/mingw64/share/verilator/include/verilated_vcd_c.cpp \
/mingw64/share/verilator/include/verilated.cpp
VFLAGS=-sv \
--trace \
--trace-max-array 8192 \
Expand Down
27 changes: 11 additions & 16 deletions verilator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ void run_tick_clk(Vpulpino_top *tb, VerilatedVcdC *tfp)
#endif
}

typedef struct {
uint32_t addr;
uint32_t data;
} HexData;


void preload_hex(Vpulpino_top *top, VerilatedVcdC *tfp, const char *filepath)
{
Expand Down Expand Up @@ -167,31 +162,31 @@ void raise_gpio(Vpulpino_top *top, VerilatedVcdC *tfp)
top->gpio_in &= ~(1 << 16);
}

static int raise_interrupt = 0;
/*static int raise_interrupt = 0;
void sig_user_handler(int sig)
{
if (sig == SIGUSR1) {
raise_interrupt = 1;
}
}
}*/

void run_simulation(Vpulpino_top *top, VerilatedVcdC *tfp)
{
top->fetch_enable_i = 1;
do {
run_tick_clk(top, tfp);
if (raise_interrupt == 1) {
/*/if (raise_interrupt == 1) {
raise_gpio(top, tfp);
raise_interrupt = 0;
}
}*/
} while ((top->gpio_out & (1 << 8)) == 0);
}

void read_user_input()
{
while (1) {
getchar();
kill(0, SIGUSR1);
//kill(0, SIGUSR1);
}
}

Expand Down Expand Up @@ -247,15 +242,15 @@ int main(int argc, char **argv) {
#endif

reset(top, tfp);
preload_hex(top, tfp, "sw/wake.hex");
preload_hex(top, tfp, "sw/helloworld.hex");

signal(SIGUSR1, sig_user_handler);
pid_t pid = fork();
if (pid == 0) {
//signal(SIGUSR1, sig_user_handler);
//pid_t pid = fork();
/*if (pid == 0) {
read_user_input();
} else {
} else {*/
run_simulation(top, tfp);
}
//}
#ifdef VM_TRACE
if (tfp)
tfp->close();
Expand Down