Decode: Fix stupid bug in which stalls did not stall the decoder.
[firearm.git] / testbench.cpp
CommitLineData
3a57f3e5
JW
1#include "Vsystem.h"
2#include <stdio.h>
1d97a095
JW
3#define _XOPEN_SOURCE
4#include <stdlib.h>
5#include <fcntl.h>
3a57f3e5
JW
6
7Vsystem *top;
8
1d97a095
JW
9void term_output(unsigned char d)
10{
11 int fd = posix_openpt(O_RDWR);
12 static int fd2 = -1;
13 char b[128];
14
15 if (fd2 == -1)
16 {
17 grantpt(fd);
18 fcntl(fd, F_SETFD, 0); /* clear close-on-exec */
19 sprintf(b, "rxvt -pty-fd %d -bg black -fg white -title \"Output terminal\" &", fd);
20 system(b);
21 unlockpt(fd);
22 fd2 = open(ptsname(fd), O_RDWR);
23 close(fd);
24 }
25 write(fd2, &d, 1);
26}
27
3a57f3e5
JW
28unsigned int main_time = 0;
29
30double sc_time_stamp ()
31{
32 return main_time;
33}
34
35int main()
36{
37 top = new Vsystem;
38
39 top->clk = 0;
40 while (!Verilated::gotFinish())
41 {
42 top->clk = !top->clk;
43
44 top->eval();
45// if (top->clk == 1)
46// printf("%d: Bubble: %d. PC: %08x. Ins'n: %08x\n", main_time/2, top->bubbleshield, top->pc, top->insn);
47
48 main_time++;
49 }
50}
This page took 0.021281 seconds and 4 git commands to generate.