mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-29 23:43:16 +00:00
namespace Yosys
This commit is contained in:
parent
bcd2625a82
commit
f9a307a50b
96 changed files with 878 additions and 585 deletions
|
@ -22,6 +22,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct MemoryPass : public Pass {
|
||||
MemoryPass() : Pass("memory", "translate memories to basic cells") { }
|
||||
virtual void help()
|
||||
|
@ -73,3 +76,4 @@ struct MemoryPass : public Pass {
|
|||
}
|
||||
} MemoryPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
|
||||
{
|
||||
if (a->type == "$memrd" && b->type == "$memrd")
|
||||
return a->name < b->name;
|
||||
|
@ -32,7 +35,7 @@ static bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
|
|||
return a->parameters.at("\\PRIORITY").as_int() < b->parameters.at("\\PRIORITY").as_int();
|
||||
}
|
||||
|
||||
static void handle_memory(RTLIL::Module *module, RTLIL::Memory *memory)
|
||||
void handle_memory(RTLIL::Module *module, RTLIL::Memory *memory)
|
||||
{
|
||||
log("Collecting $memrd and $memwr for memory `%s' in module `%s':\n",
|
||||
memory->name.c_str(), module->name.c_str());
|
||||
|
@ -205,3 +208,4 @@ struct MemoryCollectPass : public Pass {
|
|||
}
|
||||
} MemoryCollectPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
|
|
@ -22,13 +22,16 @@
|
|||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
||||
static void normalize_sig(RTLIL::Module *module, RTLIL::SigSpec &sig)
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
void normalize_sig(RTLIL::Module *module, RTLIL::SigSpec &sig)
|
||||
{
|
||||
for (auto &conn : module->connections())
|
||||
sig.replace(conn.first, conn.second);
|
||||
}
|
||||
|
||||
static bool find_sig_before_dff(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after = false)
|
||||
bool find_sig_before_dff(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after = false)
|
||||
{
|
||||
normalize_sig(module, sig);
|
||||
|
||||
|
@ -66,7 +69,7 @@ static bool find_sig_before_dff(RTLIL::Module *module, std::vector<RTLIL::Cell*>
|
|||
return true;
|
||||
}
|
||||
|
||||
static void handle_wr_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::Cell *cell)
|
||||
void handle_wr_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::Cell *cell)
|
||||
{
|
||||
log("Checking cell `%s' in module `%s': ", cell->name.c_str(), module->name.c_str());
|
||||
|
||||
|
@ -105,7 +108,7 @@ static void handle_wr_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff
|
|||
log("no (compatible) $dff found.\n");
|
||||
}
|
||||
|
||||
static void disconnect_dff(RTLIL::Module *module, RTLIL::SigSpec sig)
|
||||
void disconnect_dff(RTLIL::Module *module, RTLIL::SigSpec sig)
|
||||
{
|
||||
normalize_sig(module, sig);
|
||||
sig.sort_and_unify();
|
||||
|
@ -123,7 +126,7 @@ static void disconnect_dff(RTLIL::Module *module, RTLIL::SigSpec sig)
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_rd_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::Cell *cell)
|
||||
void handle_rd_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff_cells, RTLIL::Cell *cell)
|
||||
{
|
||||
log("Checking cell `%s' in module `%s': ", cell->name.c_str(), module->name.c_str());
|
||||
|
||||
|
@ -161,7 +164,7 @@ static void handle_rd_cell(RTLIL::Module *module, std::vector<RTLIL::Cell*> &dff
|
|||
log("no (compatible) $dff found.\n");
|
||||
}
|
||||
|
||||
static void handle_module(RTLIL::Module *module, bool flag_wr_only)
|
||||
void handle_module(RTLIL::Module *module, bool flag_wr_only)
|
||||
{
|
||||
std::vector<RTLIL::Cell*> dff_cells;
|
||||
|
||||
|
@ -216,3 +219,4 @@ struct MemoryDffPass : public Pass {
|
|||
}
|
||||
} MemoryDffPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include <set>
|
||||
#include <stdlib.h>
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct MemoryMapWorker
|
||||
{
|
||||
RTLIL::Design *design;
|
||||
|
@ -339,3 +342,4 @@ struct MemoryMapPass : public Pass {
|
|||
}
|
||||
} MemoryMapPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
#include "kernel/sigtools.h"
|
||||
#include "kernel/modtools.h"
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
static bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
|
||||
bool memcells_cmp(RTLIL::Cell *a, RTLIL::Cell *b)
|
||||
{
|
||||
if (a->type == "$memrd" && b->type == "$memrd")
|
||||
return a->name < b->name;
|
||||
|
@ -741,4 +742,3 @@ struct MemorySharePass : public Pass {
|
|||
} MemorySharePass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void handle_memory(RTLIL::Module *module, RTLIL::Cell *memory)
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
void handle_memory(RTLIL::Module *module, RTLIL::Cell *memory)
|
||||
{
|
||||
log("Creating $memrd and $memwr for memory `%s' in module `%s':\n",
|
||||
memory->name.c_str(), module->name.c_str());
|
||||
|
@ -76,7 +79,7 @@ static void handle_memory(RTLIL::Module *module, RTLIL::Cell *memory)
|
|||
module->remove(memory);
|
||||
}
|
||||
|
||||
static void handle_module(RTLIL::Design *design, RTLIL::Module *module)
|
||||
void handle_module(RTLIL::Design *design, RTLIL::Module *module)
|
||||
{
|
||||
std::vector<RTLIL::IdString> memcells;
|
||||
for (auto &cell_it : module->cells_)
|
||||
|
@ -107,3 +110,4 @@ struct MemoryUnpackPass : public Pass {
|
|||
}
|
||||
} MemoryUnpackPass;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue