mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-16 15:15:38 +00:00
unit tests: rename SigSpec::extract test
This commit is contained in:
parent
25b9b796c4
commit
a2dafce910
1 changed files with 0 additions and 0 deletions
|
|
@ -1,57 +0,0 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "kernel/rtlil.h"
|
||||
#include "tests/unit/kernel/rtlilHelpers.h"
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
namespace RTLIL {
|
||||
TEST_F(SigSpecRepTest, ExtractWires)
|
||||
{
|
||||
auto wires = createWires(4, 4);
|
||||
SigSpec sig = wiresAsSigSpec(wires);
|
||||
|
||||
SigSpec extractedFirst = sig.extract(0, 4);
|
||||
SigSpec extractedSecond = sig.extract(4, 4);
|
||||
SigSpec extractedLast = sig.extract(12, 4);
|
||||
EXPECT_EQ(extractedFirst.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedSecond.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedLast.rep_, SigSpec::Representation::CHUNK);
|
||||
}
|
||||
|
||||
TEST_F(SigSpecRepTest, ExtractConsts)
|
||||
{
|
||||
{
|
||||
SigSpec sig = constsAsSigSpec(4, 4);
|
||||
|
||||
SigSpec extractedFirst = sig.extract(0, 4);
|
||||
SigSpec extractedSecond = sig.extract(4, 4);
|
||||
SigSpec extractedLast = sig.extract(12, 4);
|
||||
std::cout << log_signal(extractedFirst) << "\n";
|
||||
EXPECT_EQ(extractedFirst.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedSecond.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedLast.rep_, SigSpec::Representation::CHUNK);
|
||||
}
|
||||
|
||||
{
|
||||
SigSpec sig;
|
||||
sig.append(Const(0, 4));
|
||||
sig.append(m->addWire("$foo", 4));
|
||||
sig.append(Const(0, 4));
|
||||
|
||||
SigSpec extractedFirst = sig.extract(0, 4);
|
||||
SigSpec extractedSecond = sig.extract(4, 4);
|
||||
SigSpec extractedLast = sig.extract(8, 4);
|
||||
EXPECT_EQ(extractedFirst.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedSecond.rep_, SigSpec::Representation::CHUNK);
|
||||
EXPECT_EQ(extractedLast.rep_, SigSpec::Representation::CHUNK);
|
||||
|
||||
SigSpec extractedFirstTwo = sig.extract(0, 8);
|
||||
EXPECT_EQ(extractedFirstTwo.rep_, SigSpec::Representation::BITS);
|
||||
SigSpec extractedLastTwo = sig.extract(0, 8);
|
||||
EXPECT_EQ(extractedLastTwo.rep_, SigSpec::Representation::BITS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
YOSYS_NAMESPACE_END
|
||||
Loading…
Add table
Add a link
Reference in a new issue