SILICON
Loading...
Searching...
No Matches
SILICON::yosys Namespace Reference

Namespaces

namespace  attributes
namespace  cells
namespace  detail

Classes

class  ModuleDependencyGraph
 Module-instantiation dependency graph for a Yosys JSON design. More...
struct  ScriptResult
class  SerializationContext
 Mutable module-building interface passed to component serializers. More...
struct  ToolOptions

Typedefs

using Json = nlohmann::ordered_json

Functions

ModuleDependencyGraph moduleDependencyGraph (std::string_view json)
 Build a module dependency graph from a Yosys write_json document.
Circuit deserialize (std::string_view json, std::optional< std::string_view > moduleName=std::nullopt)
 Deserialize one supported Yosys write_json module into a Silicon circuit.
std::string serialize (const Circuit &circuit, const std::string_view moduleName)
 Serialize a complete Silicon circuit as Yosys write_json-compatible JSON.
ScriptResult runScript (const std::string_view script, const ToolOptions &options)
std::string readVerilog (const std::string_view source, const ToolOptions &options)
std::string readVerilog (const std::span< const SILICON::core::SourceFile > sources, const std::string_view entryPath, const ToolOptions &options)
std::string elaborateHierarchy (const std::string_view json, const ToolOptions &options)
std::string writeVerilog (std::string_view json, const ToolOptions &options)

Typedef Documentation

◆ Json

using Json = nlohmann::ordered_json

Definition at line 44 of file netlist.hpp.

Function Documentation

◆ deserialize()

core::Circuit deserialize ( std::string_view json,
std::optional< std::string_view > moduleName = std::nullopt )
nodiscard

Deserialize one supported Yosys write_json module into a Silicon circuit.

When moduleName is absent, the sole module or unique module carrying the Yosys top attribute is selected. Input must already use the canonical cells supported by the direct importer; call elaborateHierarchy() first for raw frontend JSON. Cells naming another non-blackbox module in the same design become project subcircuit placeholders. Unsupported or ambiguous designs fail atomically.

Definition at line 1832 of file deserialization.cpp.

◆ elaborateHierarchy()

std::string elaborateHierarchy ( std::string_view json,
const ToolOptions & options = {} )
nodiscard

Legalize raw Yosys JSON into the canonical subset accepted by deserialize.

Definition at line 461 of file yosys_tool.cpp.

◆ moduleDependencyGraph()

ModuleDependencyGraph moduleDependencyGraph ( std::string_view json)
nodiscard

Build a module dependency graph from a Yosys write_json document.

Edges point from an instantiating module to the declared modules it instantiates. Malformed documents throw std::runtime_error with an Invalid Yosys JSON prefix.

Definition at line 1764 of file deserialization.cpp.

◆ readVerilog() [1/2]

std::string readVerilog ( const std::span< const SILICON::core::SourceFile > sources,
const std::string_view entryPath,
const ToolOptions & options )
nodiscard

Definition at line 408 of file yosys_tool.cpp.

◆ readVerilog() [2/2]

std::string readVerilog ( std::string_view source,
const ToolOptions & options = {} )
nodiscard

Read Verilog, resolve parameterized instances, and return raw Yosys JSON.

Definition at line 401 of file yosys_tool.cpp.

◆ runScript()

ScriptResult runScript ( const std::string_view script,
const ToolOptions & options )
nodiscard

Definition at line 322 of file yosys_tool.cpp.

◆ serialize()

std::string serialize ( const Circuit & circuit,
const std::string_view moduleName )
nodiscard

Serialize a complete Silicon circuit as Yosys write_json-compatible JSON.

Parameters
circuitThe circuit to serialize.
moduleNameThe Yosys module name to assign to the top-level circuit. The circuit itself owns no name; the caller supplies one (e.g. derived from the project document slug).

Definition at line 443 of file netlist.cpp.

◆ writeVerilog()

std::string writeVerilog ( std::string_view json,
const ToolOptions & options = {} )
nodiscard

Run the Yosys Verilog backend and return its raw source output.

Definition at line 494 of file yosys_tool.cpp.