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

Incomplete Testbench #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 33 additions & 1 deletion dv/ahb/SimpleDecoder/SimpleDecoder_tb.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
#include <catch2/catch_test_macros.hpp>
#include <VSimpleDecoder_tl.h>

TEST_CASE("SimpleDecoder, Dummy Test") {}

TEST_CASE("SimpleDecoder, Basic Functionality") {
VSimpleDecoder_tl* decoder = new VSimpleDecoder_tl;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a heap allocation?

Verilated::traceEverOn(true);
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary, if you want waveforms, add TRACE_FST in nyu_target_verilate()

decoder->clk = 0;
decoder->nReset = 1;
decoder->eval();
decoder->clk = 1;
decoder->eval();
decoder->clk = 0;
decoder->eval();
decoder->nReset = 0;
decoder->eval();
decoder->clk = 1;
decoder->eval();
Comment on lines +8 to +18
Copy link
Member

@rishyak rishyak Feb 21, 2024

Choose a reason for hiding this comment

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

nyu-util offers basic utilities like reset and tick. Should be replaced with nyu::reset(decoder)

Copy link
Member

Choose a reason for hiding this comment

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

You also miss the test for 0 where the selector will return 0.


//test for addresses 1 to 20
for (int address = 1; address <= 3; ++address) {
int expected_sel = 1 << (address - 1);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you subtracting?


decoder->addr = address;
decoder->eval();
decoder->clk = 0; //falling edge
decoder->eval();
decoder->clk = 1; //rising edge
decoder->eval();
Comment on lines +25 to +29
Copy link
Member

Choose a reason for hiding this comment

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

replace with nyu::tick(decoder)


CAPTURE(address, expected_sel); //capture the values
Copy link
Member

Choose a reason for hiding this comment

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

Why are you CAPTUREing the values?

REQUIRE(decoder->sel == expected_sel);
}
decoder->final();
delete decoder;
}
Loading