aboutsummaryrefslogtreecommitdiffstats
path: root/passes/techmap
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-12-04 14:14:05 +0100
committerClifford Wolf <clifford@clifford.at>2013-12-04 14:14:05 +0100
commit93a70959f3f67ffcee8159b18a5f68904e32a074 (patch)
tree1bf68c1a36c3d126fdb396b0ea9c06bcdc2040fb /passes/techmap
parenta2d053694b6269bab8871a810142943fac6a3a18 (diff)
downloadyosys-93a70959f3f67ffcee8159b18a5f68904e32a074.tar.gz
yosys-93a70959f3f67ffcee8159b18a5f68904e32a074.tar.bz2
yosys-93a70959f3f67ffcee8159b18a5f68904e32a074.zip
Replaced RTLIL::Const::str with generic decoder method
Diffstat (limited to 'passes/techmap')
-rw-r--r--passes/techmap/techmap.cc18
1 files changed, 3 insertions, 15 deletions
diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc
index d56e465e0..8dd96b837 100644
--- a/passes/techmap/techmap.cc
+++ b/passes/techmap/techmap.cc
@@ -313,19 +313,7 @@ static bool techmap_module(RTLIL::Design *design, RTLIL::Module *module, RTLIL::
data.wire->name = new_name;
tpl->add(data.wire);
- std::string cmd_string;
- std::vector<char> cmd_string_chars;
- std::vector<RTLIL::State> bits = data.value.as_const().bits;
- for (int i = 0; i < int(bits.size()); i += 8) {
- char ch = 0;
- for (int j = 0; j < 8 && i+j < int(bits.size()); j++)
- if (bits[i+j] == RTLIL::State::S1)
- ch |= 1 << j;
- if (ch != 0)
- cmd_string_chars.push_back(ch);
- }
- for (int i = int(cmd_string_chars.size())-1; i >= 0; i--)
- cmd_string += cmd_string_chars[i];
+ std::string cmd_string = data.value.as_const().decode_string();
RTLIL::Selection tpl_mod_sel(false);
tpl_mod_sel.select(tpl);
@@ -507,8 +495,8 @@ struct TechmapPass : public Pass {
std::map<RTLIL::IdString, std::set<RTLIL::IdString>> celltypeMap;
for (auto &it : map->modules) {
- if (it.second->attributes.count("\\techmap_celltype") && !it.second->attributes.at("\\techmap_celltype").str.empty()) {
- char *p = strdup(it.second->attributes.at("\\techmap_celltype").str.c_str());
+ if (it.second->attributes.count("\\techmap_celltype") && !it.second->attributes.at("\\techmap_celltype").bits.empty()) {
+ char *p = strdup(it.second->attributes.at("\\techmap_celltype").decode_string().c_str());
for (char *q = strtok(p, " \t\r\n"); q; q = strtok(NULL, " \t\r\n"))
celltypeMap[RTLIL::escape_id(q)].insert(it.first);
free(p);