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;
|
||||
}
|
||||
|
||||
const char *log_signal(DriveChunkWire const &chunk)
|
||||
std::string log_signal(DriveChunkWire const &chunk)
|
||||
{
|
||||
const char *id = log_id(chunk.wire->name);
|
||||
if (chunk.is_whole())
|
||||
return id;
|
||||
if (chunk.width == 1)
|
||||
return log_str(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]", id, 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 *port_id = log_id(chunk.port);
|
||||
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)
|
||||
return log_str(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]", cell_id, port_id, 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)
|
||||
return log_str(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]", chunk.marker, 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())
|
||||
{
|
||||
case DriveType::NONE:
|
||||
return log_str(stringf("<none x%d>", chunk.size()));
|
||||
return stringf("<none x%d>", chunk.size());
|
||||
case DriveType::CONSTANT:
|
||||
return log_const(chunk.constant());
|
||||
case DriveType::WIRE:
|
||||
|
@ -917,14 +917,14 @@ const char *log_signal(DriveChunk const &chunk)
|
|||
str += log_signal(single);
|
||||
}
|
||||
str += ">";
|
||||
return log_str(str);
|
||||
return str;
|
||||
}
|
||||
default:
|
||||
log_abort();
|
||||
}
|
||||
}
|
||||
|
||||
const char *log_signal(DriveSpec const &spec)
|
||||
std::string log_signal(DriveSpec const &spec)
|
||||
{
|
||||
auto &chunks = spec.chunks();
|
||||
if (chunks.empty())
|
||||
|
@ -943,7 +943,7 @@ const char *log_signal(DriveSpec const &spec)
|
|||
}
|
||||
str += " }";
|
||||
|
||||
return log_str(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
YOSYS_NAMESPACE_END
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef DRIVERTOOLS_H
|
||||
#define DRIVERTOOLS_H
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "kernel/rtlil.h"
|
||||
|
@ -39,11 +40,11 @@ struct DriveChunk;
|
|||
|
||||
struct DriveSpec;
|
||||
|
||||
const char *log_signal(DriveChunkWire const &chunk);
|
||||
const char *log_signal(DriveChunkPort const &chunk);
|
||||
const char *log_signal(DriveChunkMarker const &chunk);
|
||||
const char *log_signal(DriveChunk const &chunk);
|
||||
const char *log_signal(DriveSpec const &chunk);
|
||||
std::string log_signal(DriveChunkWire const &chunk);
|
||||
std::string log_signal(DriveChunkPort const &chunk);
|
||||
std::string log_signal(DriveChunkMarker const &chunk);
|
||||
std::string log_signal(DriveChunk const &chunk);
|
||||
std::string log_signal(DriveSpec const &chunk);
|
||||
|
||||
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. "
|
||||
"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
|
||||
void check_undriven(DriveSpec const& spec, std::string const& name) {
|
||||
for(auto const &chunk : spec.chunks())
|
||||
if(chunk.is_none())
|
||||
undriven(name.c_str());
|
||||
undriven(name);
|
||||
}
|
||||
public:
|
||||
void process_queue()
|
||||
|
@ -706,11 +706,11 @@ public:
|
|||
factory.update_pending(pending, node);
|
||||
} else if (chunk.is_multiple()) {
|
||||
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()) {
|
||||
undriven(log_signal(chunk));
|
||||
} else {
|
||||
log_error("unhandled drivespec: %s\n", log_signal(chunk));
|
||||
log_error("unhandled drivespec: %s\n", log_signal(chunk).c_str());
|
||||
log_abort();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -669,16 +669,6 @@ const char *log_id(const RTLIL::IdString &str)
|
|||
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)
|
||||
{
|
||||
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_const(const RTLIL::Const &value, bool autoint = true);
|
||||
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) {
|
||||
if (nullstr && obj == nullptr)
|
||||
|
|
|
@ -173,7 +173,7 @@ struct ExampleDtPass : public Pass
|
|||
node.set_function(ID($$undriven));
|
||||
|
||||
} else {
|
||||
log_error("unhandled drivespec: %s\n", log_signal(chunk));
|
||||
log_error("unhandled drivespec: %s\n", log_signal(chunk).c_str());
|
||||
log_abort();
|
||||
}
|
||||
} else {
|
||||
|
@ -243,7 +243,7 @@ struct ExampleDtPass : public Pass
|
|||
log(")\n");
|
||||
if (ref.has_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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue