From: Sam Moore Date: Fri, 11 Apr 2014 07:12:30 +0000 (+0800) Subject: Allow VFPU to save output vcd file X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=commitdiff_plain;h=7fc41b098090ad2d365ef34700542656947aa8ff Allow VFPU to save output vcd file That was amazingly simple. Can run `gtkwave` on the output vcd file to see all the signals! --- diff --git a/src/vfpu.cpp b/src/vfpu.cpp index 2c6d703..85637ff 100644 --- a/src/vfpu.cpp +++ b/src/vfpu.cpp @@ -32,7 +32,7 @@ static pid_t g_fpu_pid = -1; * Starts the VFPU * @returns 0 on success, errno of the failing function on failure */ -int Start() +int Start(const char * vcd_output) { assert(!g_running); // create unix socket pair @@ -59,7 +59,16 @@ int Start() Debug("Child about to suppress stderr and exec vfpu"); dup2(open("/dev/null", O_APPEND), fileno(stderr)); //LALALA I AM NOT LISTENING TO YOUR STUPID ERRORS GHDL - execl(g_fpu, g_fpu,NULL); + if (vcd_output != NULL) + { + string s("--vcd="); + s += vcd_output; + execl(g_fpu, g_fpu, s.c_str(), NULL); + } + else + { + execl(g_fpu, g_fpu,NULL); + } int err = errno; // Because errno will be set again by the next system call Fatal("Uh oh! %s\n", strerror(err)); // We will never see this if something goes wrong... oh dear exit(err); // Child exits here. diff --git a/src/vfpu.h b/src/vfpu.h index edf471a..12ac9bc 100644 --- a/src/vfpu.h +++ b/src/vfpu.h @@ -9,7 +9,7 @@ namespace VFPU { - extern int Start(); // Starts the VFPU + extern int Start(const char * vcd_output = NULL); // Starts the VFPU extern int Halt(); // Halts the VFPU /**