diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-03-16 15:21:03 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-03-16 15:21:03 +0800 |
| commit | 660e5ce626965105f6a9327c66ba251f17f7c5f7 (patch) | |
| tree | bfe5e44e6074feee02368bc5954fc06cf714f1f0 /rv64cpu/tb/unit/tb_decoder.cc | |
| parent | 1554746fd79d51c6bd2281820520a4e2d2c16301 (diff) | |
| parent | 161eb7764bb9054aa21080b5100a4e743ab91fd6 (diff) | |
| download | rcc-project-660e5ce626965105f6a9327c66ba251f17f7c5f7.tar.gz rcc-project-660e5ce626965105f6a9327c66ba251f17f7c5f7.tar.xz | |
Merge pull request #1 from Richard-Qin-001/expand-tests
Expand tests and format output
Diffstat (limited to 'rv64cpu/tb/unit/tb_decoder.cc')
| -rw-r--r-- | rv64cpu/tb/unit/tb_decoder.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/rv64cpu/tb/unit/tb_decoder.cc b/rv64cpu/tb/unit/tb_decoder.cc index e55bbb6..aa6788c 100644 --- a/rv64cpu/tb/unit/tb_decoder.cc +++ b/rv64cpu/tb/unit/tb_decoder.cc @@ -31,10 +31,10 @@ static int fail_count = 0; uint64_t _got = (uint64_t)(dut->signal); \ uint64_t _exp = (uint64_t)(expected); \ if (_got != _exp) { \ - std::cerr << "\033[31m[FAIL]\033[0m " << test_name \ + std::cerr << "\033[31m[FAIL] " << test_name \ << " | " << #signal << " expected: 0x" \ << std::hex << _exp << " got: 0x" << _got \ - << std::dec << std::endl; \ + << std::dec << "\033[0m" << std::endl; \ fail_count++; \ } \ } while(0) @@ -43,18 +43,18 @@ void decode(Vdecoder* dut, uint32_t instr, const char* name) { dut->instr = instr; dut->eval(); test_count++; - std::cout << "[TEST " << std::setw(2) << test_count << "] " << name + std::cout << "\033[32m[PASS] [TEST " << std::setw(2) << test_count << "] " << name << " (0x" << std::hex << std::setw(8) << std::setfill('0') - << instr << std::dec << std::setfill(' ') << ")" << std::endl; + << instr << std::dec << std::setfill(' ') << ")\033[0m" << std::endl; } int main(int argc, char** argv) { Verilated::commandArgs(argc, argv); Vdecoder* dut = new Vdecoder; - std::cout << "═══════════════════════════════════════════════" << std::endl; - std::cout << " Decoder Unit Test Suite" << std::endl; - std::cout << "═══════════════════════════════════════════════" << std::endl; + std::cout << "----------------------------------" << std::endl; + std::cout << " Decoder Unit Test" << std::endl; + std::cout << "----------------------------------" << std::endl; // 1. R-type: ADD x1, x2, x3 // funct7=0000000 rs2=00011 rs1=00010 funct3=000 rd=00001 op=0110011 @@ -285,13 +285,14 @@ int main(int argc, char** argv) { CHECK(dut, reg_write_en, 0, "Illegal"); // Results - std::cout << "═══════════════════════════════════════════════" << std::endl; + std::cout << "----------------------------------" << std::endl; if (fail_count == 0) { std::cout << "\033[32mAll " << test_count << " tests passed!\033[0m" << std::endl; } else { std::cout << "\033[31m" << fail_count << " check(s) FAILED out of " << test_count << " tests.\033[0m" << std::endl; } + std::cout << "----------------------------------" << std::endl; delete dut; return (fail_count > 0) ? 1 : 0; |
