mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-03 18:00:24 +00:00
Merge ec3f384dca
into 262b00d5e5
This commit is contained in:
commit
15bf563db9
6 changed files with 28 additions and 39 deletions
|
@ -865,41 +865,41 @@ DriveSpec DriverMap::operator()(DriveSpec spec)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_signal(DriveChunkWire const &chunk)
|
std::string log_signal(DriveChunkWire const &chunk)
|
||||||
{
|
{
|
||||||
const char *id = log_id(chunk.wire->name);
|
const char *id = log_id(chunk.wire->name);
|
||||||
if (chunk.is_whole())
|
if (chunk.is_whole())
|
||||||
return id;
|
return id;
|
||||||
if (chunk.width == 1)
|
if (chunk.width == 1)
|
||||||
return log_str(stringf("%s [%d]", id, chunk.offset));
|
return stringf("%s [%d]", id, chunk.offset);
|
||||||
return log_str(stringf("%s [%d:%d]", id, chunk.offset + chunk.width - 1, chunk.offset));
|
return stringf("%s [%d:%d]", id, chunk.offset + chunk.width - 1, chunk.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *log_signal(DriveChunkPort const &chunk)
|
std::string log_signal(DriveChunkPort const &chunk)
|
||||||
{
|
{
|
||||||
const char *cell_id = log_id(chunk.cell->name);
|
const char *cell_id = log_id(chunk.cell->name);
|
||||||
const char *port_id = log_id(chunk.port);
|
const char *port_id = log_id(chunk.port);
|
||||||
if (chunk.is_whole())
|
if (chunk.is_whole())
|
||||||
return log_str(stringf("%s <%s>", cell_id, port_id));
|
return stringf("%s <%s>", cell_id, port_id);
|
||||||
if (chunk.width == 1)
|
if (chunk.width == 1)
|
||||||
return log_str(stringf("%s <%s> [%d]", cell_id, port_id, chunk.offset));
|
return stringf("%s <%s> [%d]", cell_id, port_id, chunk.offset);
|
||||||
return log_str(stringf("%s <%s> [%d:%d]", cell_id, port_id, chunk.offset + chunk.width - 1, chunk.offset));
|
return stringf("%s <%s> [%d:%d]", cell_id, port_id, chunk.offset + chunk.width - 1, chunk.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_signal(DriveChunkMarker const &chunk)
|
std::string log_signal(DriveChunkMarker const &chunk)
|
||||||
{
|
{
|
||||||
if (chunk.width == 1)
|
if (chunk.width == 1)
|
||||||
return log_str(stringf("<marker %d> [%d]", chunk.marker, chunk.offset));
|
return stringf("<marker %d> [%d]", chunk.marker, chunk.offset);
|
||||||
return log_str(stringf("<marker %d> [%d:%d]", chunk.marker, chunk.offset + chunk.width - 1, chunk.offset));
|
return stringf("<marker %d> [%d:%d]", chunk.marker, chunk.offset + chunk.width - 1, chunk.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_signal(DriveChunk const &chunk)
|
std::string log_signal(DriveChunk const &chunk)
|
||||||
{
|
{
|
||||||
switch (chunk.type())
|
switch (chunk.type())
|
||||||
{
|
{
|
||||||
case DriveType::NONE:
|
case DriveType::NONE:
|
||||||
return log_str(stringf("<none x%d>", chunk.size()));
|
return stringf("<none x%d>", chunk.size());
|
||||||
case DriveType::CONSTANT:
|
case DriveType::CONSTANT:
|
||||||
return log_const(chunk.constant());
|
return log_const(chunk.constant());
|
||||||
case DriveType::WIRE:
|
case DriveType::WIRE:
|
||||||
|
@ -917,14 +917,14 @@ const char *log_signal(DriveChunk const &chunk)
|
||||||
str += log_signal(single);
|
str += log_signal(single);
|
||||||
}
|
}
|
||||||
str += ">";
|
str += ">";
|
||||||
return log_str(str);
|
return str;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log_abort();
|
log_abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_signal(DriveSpec const &spec)
|
std::string log_signal(DriveSpec const &spec)
|
||||||
{
|
{
|
||||||
auto &chunks = spec.chunks();
|
auto &chunks = spec.chunks();
|
||||||
if (chunks.empty())
|
if (chunks.empty())
|
||||||
|
@ -943,7 +943,7 @@ const char *log_signal(DriveSpec const &spec)
|
||||||
}
|
}
|
||||||
str += " }";
|
str += " }";
|
||||||
|
|
||||||
return log_str(str);
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
YOSYS_NAMESPACE_END
|
YOSYS_NAMESPACE_END
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef DRIVERTOOLS_H
|
#ifndef DRIVERTOOLS_H
|
||||||
#define DRIVERTOOLS_H
|
#define DRIVERTOOLS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "kernel/rtlil.h"
|
#include "kernel/rtlil.h"
|
||||||
|
@ -39,11 +40,11 @@ struct DriveChunk;
|
||||||
|
|
||||||
struct DriveSpec;
|
struct DriveSpec;
|
||||||
|
|
||||||
const char *log_signal(DriveChunkWire const &chunk);
|
std::string log_signal(DriveChunkWire const &chunk);
|
||||||
const char *log_signal(DriveChunkPort const &chunk);
|
std::string log_signal(DriveChunkPort const &chunk);
|
||||||
const char *log_signal(DriveChunkMarker const &chunk);
|
std::string log_signal(DriveChunkMarker const &chunk);
|
||||||
const char *log_signal(DriveChunk const &chunk);
|
std::string log_signal(DriveChunk const &chunk);
|
||||||
const char *log_signal(DriveSpec const &chunk);
|
std::string log_signal(DriveSpec const &chunk);
|
||||||
|
|
||||||
enum class DriveType : unsigned char
|
enum class DriveType : unsigned char
|
||||||
{
|
{
|
||||||
|
|
|
@ -635,15 +635,15 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void undriven(const char *name) {
|
void undriven(const std::string& name) {
|
||||||
log_error("The design contains an undriven signal %s. This is not supported by the functional backend. "
|
log_error("The design contains an undriven signal %s. This is not supported by the functional backend. "
|
||||||
"Call setundef with appropriate options to avoid this error.\n", name);
|
"Call setundef with appropriate options to avoid this error.\n", name.c_str());
|
||||||
}
|
}
|
||||||
// we perform this check separately to give better error messages that include the wire or port name
|
// we perform this check separately to give better error messages that include the wire or port name
|
||||||
void check_undriven(DriveSpec const& spec, std::string const& name) {
|
void check_undriven(DriveSpec const& spec, std::string const& name) {
|
||||||
for(auto const &chunk : spec.chunks())
|
for(auto const &chunk : spec.chunks())
|
||||||
if(chunk.is_none())
|
if(chunk.is_none())
|
||||||
undriven(name.c_str());
|
undriven(name);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void process_queue()
|
void process_queue()
|
||||||
|
@ -706,11 +706,11 @@ public:
|
||||||
factory.update_pending(pending, node);
|
factory.update_pending(pending, node);
|
||||||
} else if (chunk.is_multiple()) {
|
} else if (chunk.is_multiple()) {
|
||||||
log_error("Signal %s has multiple drivers. This is not supported by the functional backend. "
|
log_error("Signal %s has multiple drivers. This is not supported by the functional backend. "
|
||||||
"If tristate drivers are used, call tristate -formal to avoid this error.\n", log_signal(chunk));
|
"If tristate drivers are used, call tristate -formal to avoid this error.\n", log_signal(chunk).c_str());
|
||||||
} else if (chunk.is_none()) {
|
} else if (chunk.is_none()) {
|
||||||
undriven(log_signal(chunk));
|
undriven(log_signal(chunk));
|
||||||
} else {
|
} else {
|
||||||
log_error("unhandled drivespec: %s\n", log_signal(chunk));
|
log_error("unhandled drivespec: %s\n", log_signal(chunk).c_str());
|
||||||
log_abort();
|
log_abort();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -669,16 +669,6 @@ const char *log_id(const RTLIL::IdString &str)
|
||||||
return log_id_cache.back();
|
return log_id_cache.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_str(const char *str)
|
|
||||||
{
|
|
||||||
log_id_cache.push_back(strdup(str));
|
|
||||||
return log_id_cache.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *log_str(std::string const &str) {
|
|
||||||
return log_str(str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_module(RTLIL::Module *module, std::string indent)
|
void log_module(RTLIL::Module *module, std::string indent)
|
||||||
{
|
{
|
||||||
std::stringstream buf;
|
std::stringstream buf;
|
||||||
|
|
|
@ -206,8 +206,6 @@ void log_check_expected();
|
||||||
const char *log_signal(const RTLIL::SigSpec &sig, bool autoint = true);
|
const char *log_signal(const RTLIL::SigSpec &sig, bool autoint = true);
|
||||||
const char *log_const(const RTLIL::Const &value, bool autoint = true);
|
const char *log_const(const RTLIL::Const &value, bool autoint = true);
|
||||||
const char *log_id(const RTLIL::IdString &id);
|
const char *log_id(const RTLIL::IdString &id);
|
||||||
const char *log_str(const char *str);
|
|
||||||
const char *log_str(std::string const &str);
|
|
||||||
|
|
||||||
template<typename T> static inline const char *log_id(T *obj, const char *nullstr = nullptr) {
|
template<typename T> static inline const char *log_id(T *obj, const char *nullstr = nullptr) {
|
||||||
if (nullstr && obj == nullptr)
|
if (nullstr && obj == nullptr)
|
||||||
|
|
|
@ -173,7 +173,7 @@ struct ExampleDtPass : public Pass
|
||||||
node.set_function(ID($$undriven));
|
node.set_function(ID($$undriven));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log_error("unhandled drivespec: %s\n", log_signal(chunk));
|
log_error("unhandled drivespec: %s\n", log_signal(chunk).c_str());
|
||||||
log_abort();
|
log_abort();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -243,7 +243,7 @@ struct ExampleDtPass : public Pass
|
||||||
log(")\n");
|
log(")\n");
|
||||||
if (ref.has_sparse_attr())
|
if (ref.has_sparse_attr())
|
||||||
log("// wire %s\n", log_id(ref.sparse_attr()));
|
log("// wire %s\n", log_id(ref.sparse_attr()));
|
||||||
log("// was #%d %s\n", ref.attr(), log_signal(queue[ref.attr()]));
|
log("// was #%d %s\n", ref.attr(), log_signal(queue[ref.attr()]).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const &key : compute_graph.keys())
|
for (auto const &key : compute_graph.keys())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue