3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-02-07 01:32:15 +00:00

modify generator for pyosys/wrappers.cc instead of headers

This commit is contained in:
Natalia 2026-01-18 02:11:09 -08:00
parent fb864e91ee
commit cf511628b0
5 changed files with 22 additions and 68 deletions

View file

@ -0,0 +1,12 @@
from pathlib import Path
from pyosys import libyosys as ys
__file_dir__ = Path(__file__).absolute().parent
design = ys.Design()
design.run_pass(
["read_verilog", str(__file_dir__.parent / "simple" / "fiedler-cooley.v")]
)
design.run_pass("prep")
design.run_pass(["opt", "-full"])

View file

@ -1,59 +0,0 @@
#include <gtest/gtest.h>
#include "kernel/rtlil.h"
#include "kernel/register.h"
YOSYS_NAMESPACE_BEGIN
class DesignRunPassTest : public testing::Test {
protected:
DesignRunPassTest() {
if (log_files.empty()) log_files.emplace_back(stdout);
}
virtual void SetUp() override {
IdString::ensure_prepopulated();
}
};
TEST_F(DesignRunPassTest, RunPassExecutesSuccessfully)
{
// Create a design with a simple module
RTLIL::Design *design = new RTLIL::Design;
RTLIL::Module *module = new RTLIL::Module;
module->name = RTLIL::IdString("\\test_module");
design->add(module);
// Add a simple wire to the module
RTLIL::Wire *wire = module->addWire(RTLIL::IdString("\\test_wire"), 1);
wire->port_input = true;
wire->port_id = 1;
module->fixup_ports();
// Call run_pass with a simple pass
// We use "check" which is a simple pass that just validates the design
ASSERT_NO_THROW(design->run_pass("check"));
// Verify the design still exists and has the module
EXPECT_EQ(design->modules().size(), 1);
EXPECT_NE(design->module(RTLIL::IdString("\\test_module")), nullptr);
delete design;
}
TEST_F(DesignRunPassTest, RunPassWithHierarchy)
{
// Create a design with a simple module
RTLIL::Design *design = new RTLIL::Design;
RTLIL::Module *module = new RTLIL::Module;
module->name = RTLIL::IdString("\\top");
design->add(module);
// Call run_pass with hierarchy pass
ASSERT_NO_THROW(design->run_pass("hierarchy"));
// Verify the design still has the module
EXPECT_EQ(design->modules().size(), 1);
delete design;
}
YOSYS_NAMESPACE_END