Skip to content

Commit

Permalink
Simplify file descriptor handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jserv committed Oct 26, 2023
1 parent a36f35e commit 0337caa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ This feature can be utilized for tests involving the emulator, such as compiler
You can also combine this option with `-q` to directly use the output.
For example, if you want to read the register x10 (a0), then run the following command:
```shell
$ build/rv32emu -d - out.elf -q | jq .x10
$ build/rv32emu -d - -q out.elf | jq .x10
```

## RISC-V Instructions/Registers Usage Statistics
Expand Down
8 changes: 1 addition & 7 deletions src/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,13 +1038,7 @@ void ecall_handler(riscv_t *rv)

void dump_registers(riscv_t *rv, char *out_file_path)
{
FILE *f;
if (!strncmp(out_file_path, "-", 1)) {
f = stdout;
} else {
f = fopen(out_file_path, "w");
}

FILE *f = out_file_path[0] == '-' ? stdout : fopen(out_file_path, "w");
if (!f) {
fprintf(stderr, "Cannot open registers output file.\n");
return;
Expand Down

1 comment on commit 0337caa

@jserv
Copy link
Contributor Author

@jserv jserv commented on 0337caa Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Benchmark suite Current: 0337caa Previous: c6e7e66 Ratio
Dhrystone 1237 Average DMIPS over 10 runs 1445.5 Average DMIPS over 10 runs 1.17
Coremark 1056.257 Average iterations/sec over 10 runs 1125.137 Average iterations/sec over 10 runs 1.07

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.