File size: 1,962 Bytes
5cdf637 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2023-2025, The OpenROAD Authors
#include <unistd.h>
#include <sstream>
#include <string>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "odb/db.h"
#include "odb/dbWireCodec.h"
#include "odb/lefout.h"
#include "tst/sky130_fixture.h"
#include "utl/Logger.h"
namespace odb {
using ::testing::HasSubstr;
using tst::Sky130Fixture;
TEST_F(Sky130Fixture, AbstractLefWriterMapsTieOffToSignal)
{
// Arrange
std::ostringstream os;
odb::lefout lefout(&logger_, os);
odb::dbNet* tieoff_net = odb::dbNet::create(block_, "tieoff_net");
tieoff_net->setSigType(odb::dbSigType::TIEOFF);
odb::dbBTerm::create(tieoff_net, "tieoff_pin");
// Act
lefout.writeAbstractLef(block_);
std::string result = os.str();
// Assert
// Not Found
EXPECT_THAT(result, Not(HasSubstr("TIEOFF")));
// Found
EXPECT_THAT(result, HasSubstr("SIGNAL"));
}
TEST_F(Sky130Fixture, AbstractLefWriterMapsScanToSignal)
{
// Arrange
std::ostringstream os;
odb::lefout lefout(&logger_, os);
odb::dbNet* tieoff_net = odb::dbNet::create(block_, "scan_net");
tieoff_net->setSigType(odb::dbSigType::SCAN);
odb::dbBTerm::create(tieoff_net, "scan_pin");
// Act
lefout.writeAbstractLef(block_);
std::string result = os.str();
// Assert
// Not Found
EXPECT_THAT(result, Not(HasSubstr("SCAN")));
// Found
EXPECT_THAT(result, HasSubstr("SIGNAL"));
}
TEST_F(Sky130Fixture, AbstractLefWriterMapsResetToSignal)
{
// Arrange
std::ostringstream os;
odb::lefout lefout(&logger_, os);
odb::dbNet* tieoff_net = odb::dbNet::create(block_, "reset_net");
tieoff_net->setSigType(odb::dbSigType::RESET);
odb::dbBTerm::create(tieoff_net, "reset_pin");
// Act
lefout.writeAbstractLef(block_);
std::string result = os.str();
// Assert
// Not Found
EXPECT_THAT(result, Not(HasSubstr("RESET")));
// Found
EXPECT_THAT(result, HasSubstr("SIGNAL"));
}
} // namespace odb
|