-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
Verilated::traceEverOn(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary, if you want waveforms, add |
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nyu-util offers basic utilities like There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace with |
||
|
||
CAPTURE(address, expected_sel); //capture the values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you |
||
REQUIRE(decoder->sel == expected_sel); | ||
} | ||
decoder->final(); | ||
delete decoder; | ||
} |
There was a problem hiding this comment.
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?