From 2446b6fbefc51a0f64e68c44cb44ac2d3b2d538a Mon Sep 17 00:00:00 2001 From: Ahmed Irfan Date: Tue, 2 Sep 2014 14:47:51 +0200 Subject: [PATCH] added $pmux cell translation --- backends/btor/btor.cc | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/backends/btor/btor.cc b/backends/btor/btor.cc index 03ef183a5..2eac675e0 100644 --- a/backends/btor/btor.cc +++ b/backends/btor/btor.cc @@ -638,7 +638,42 @@ struct BtorDumper fprintf(f, "%s\n", str.c_str()); line_ref[cell->name]=line_num; } - //registers + else if(cell->type == "$pmux") + { + log("writing pmux cell\n"); + int output_width = cell->parameters.at(RTLIL::IdString("\\WIDTH")).as_int(); + int select_width = cell->parameters.at(RTLIL::IdString("\\S_WIDTH")).as_int(); + int default_case = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\A")), output_width); + int cases = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\B")), output_width*select_width); + int select = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\S")), select_width); + int *c = new int[select_width]; + + for (int i=0; i=0; --i) + { + ++line_num; + str = stringf ("%d cond 1 %d %d %d", line_num, c[i], c[i]+1, line_num-1); + fprintf(f, "%s\n", str.c_str()); + } + + line_ref[cell->name]=line_num; + } + //registers else if(cell->type == "$dff" || cell->type == "$adff" || cell->type == "$dffsr") { //TODO: remodelling fo adff cells @@ -767,7 +802,8 @@ struct BtorDumper assert(output->width == output_width); int offset = cell->parameters.at(RTLIL::IdString("\\OFFSET")).as_int(); ++line_num; - str = stringf("%d %s %d %d %d %d", line_num, cell_type_translation.at(cell->type).c_str(), output_width, input_line, output_width+offset-1, offset); + str = stringf("%d %s %d %d %d %d", line_num, cell_type_translation.at(cell->type).c_str(), + output_width, input_line, output_width+offset-1, offset); fprintf(f, "%s\n", str.c_str()); line_ref[cell->name]=line_num; } -- 2.30.2