From 6de8fea2c77abb936ba2356bf5c1425a15f5edd7 Mon Sep 17 00:00:00 2001 From: luke whittlesey Date: Sun, 10 May 2015 11:33:24 -0400 Subject: Made changes recommended by Clifford Wolf ... Removed bit_check_equal(), used RTLIL::SigBit for individual bits, used dict<> instead of std::map, and used RTLIL::SigSpec instead of std::vector. --- backends/verilog/verilog_backend.cc | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index a7457d91e..8b8c3d7b1 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -153,17 +153,6 @@ bool is_reg_wire(RTLIL::SigSpec sig, std::string ®_name) return true; } -bool bit_check_equal(SigMap &sigmap, RTLIL::SigSpec &a, RTLIL::SigSpec &b) -{ - if (a.is_fully_const() && b.is_fully_const()){ - return (a.as_bool() == b.as_bool()); - }else if (!a.is_fully_const() && !b.is_fully_const()){ - return (sigmap(a) == sigmap(b)); - }else{ - return false; - } -} - void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool no_decimal = false, bool set_signed = false, bool escape_comment = false) { if (width < 0) @@ -892,10 +881,11 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell) } int nwrite_ports = cell->parameters["\\WR_PORTS"].as_int(); - RTLIL::SigSpec sig_wr_clk, sig_wr_data, sig_wr_addr, sig_wr_en, sig_wr_en_bit, last_bit, current_bit; - bool wr_clk_posedge; //, use_wen; //, use_individual_wen_bits; - std::vector lof_wen; - std::map wen_to_width; + RTLIL::SigSpec sig_wr_clk, sig_wr_data, sig_wr_addr, sig_wr_en, sig_wr_en_bit; + RTLIL::SigBit last_bit, current_bit; + bool wr_clk_posedge; + RTLIL::SigSpec lof_wen; + dict wen_to_width; SigMap sigmap(active_module); int n, wen_width; // write ports @@ -913,15 +903,15 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell) wr_clk_posedge = cell->parameters["\\WR_CLK_POLARITY"].extract(i).as_bool(); // group the wen bits last_bit = sig_wr_en.extract(0); - lof_wen.push_back(last_bit); + lof_wen.append_bit(last_bit); wen_to_width[last_bit] = 0; for(int j=0; j