Add BLIF support for ternary (MUX) operators.
This commit is contained in:
parent
999a53ab75
commit
6684b2db04
|
|
@ -45,7 +45,7 @@ CXXFLAGS = @WARNING_FLAGS@ @CXXFLAGS@
|
|||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
O = blif.o constants.o logic_gate.o lpm.o lpm_add.o lpm_cmp_eq.o lpm_cmp_gt.o \
|
||||
lpm_part_vp.o lpm_re_logic.o nex_data.o
|
||||
lpm_mux.o lpm_part_vp.o lpm_re_logic.o nex_data.o
|
||||
|
||||
all: dep blif.tgt
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ int print_lpm(FILE*fd, ivl_lpm_t net)
|
|||
case IVL_LPM_CMP_NEE:
|
||||
rc += print_lpm_cmp_ne(fd, net);
|
||||
break;
|
||||
case IVL_LPM_MUX:
|
||||
rc += print_lpm_mux(fd, net);
|
||||
break;
|
||||
case IVL_LPM_PART_VP:
|
||||
rc += print_lpm_part_vp(fd, net);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
# include "priv.h"
|
||||
# include "nex_data.h"
|
||||
# include <cassert>
|
||||
|
||||
int print_lpm_mux(FILE*fd, ivl_lpm_t net)
|
||||
{
|
||||
ivl_nexus_t nex_out = ivl_lpm_q(net);
|
||||
blif_nex_data_t*ned_out = blif_nex_data_t::get_nex_data(nex_out);
|
||||
|
||||
ivl_nexus_t nex_sel = ivl_lpm_select(net);
|
||||
blif_nex_data_t*ned_sel = blif_nex_data_t::get_nex_data(nex_sel);
|
||||
|
||||
ivl_nexus_t nex_d0 = ivl_lpm_data(net,0);
|
||||
blif_nex_data_t*ned_d0 = blif_nex_data_t::get_nex_data(nex_d0);
|
||||
|
||||
ivl_nexus_t nex_d1 = ivl_lpm_data(net,1);
|
||||
blif_nex_data_t*ned_d1 = blif_nex_data_t::get_nex_data(nex_d1);
|
||||
|
||||
assert(ivl_lpm_width(net) == ned_out->get_width());
|
||||
assert(ivl_lpm_width(net) == ned_d0->get_width());
|
||||
assert(ivl_lpm_width(net) == ned_d1->get_width());
|
||||
|
||||
// Only support single-bit select
|
||||
assert(ned_sel->get_width() == 1);
|
||||
|
||||
for (unsigned idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1) {
|
||||
fprintf(fd, ".names %s%s %s%s %s%s %s%s\n"
|
||||
"01- 1\n"
|
||||
"1-1 1\n",
|
||||
ned_sel->get_name(), ned_sel->get_name_index(0),
|
||||
ned_d0->get_name(), ned_d0->get_name_index(idx),
|
||||
ned_d1->get_name(), ned_d1->get_name_index(idx),
|
||||
ned_out->get_name(), ned_out->get_name_index(idx));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ extern int print_lpm_sub(FILE*fd, ivl_lpm_t net);
|
|||
extern int print_lpm_cmp_eq(FILE*fd, ivl_lpm_t net);
|
||||
extern int print_lpm_cmp_gt(FILE*fd, ivl_lpm_t net);
|
||||
extern int print_lpm_cmp_ne(FILE*fd, ivl_lpm_t net);
|
||||
extern int print_lpm_mux(FILE*fd, ivl_lpm_t net);
|
||||
extern int print_lpm_part_vp(FILE*fd, ivl_lpm_t net);
|
||||
extern int print_lpm_re_logic(FILE*fd, ivl_lpm_t net);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue