vlog95: block generating a concat-Z LPM device in the compiler.

Since the vlog95 code generator needs the strength information we do
not want to hide it behind a concat-Z optimization. For now we abort
the optimization, but in the future we could add parts of this back
in (e.g. all the drivers have matching strength then replace with a
normal concat and a buf-Z if the strength are not both strong. The
original buf-Z should be removed to reduce the number of LPM devices).
This commit is contained in:
Cary R 2013-02-13 19:12:54 -08:00
parent 8b4dc05ff8
commit 28bc333cba
6 changed files with 31 additions and 4 deletions

View File

@ -1,7 +1,7 @@
#ifndef __compiler_H #ifndef __compiler_H
#define __compiler_H #define __compiler_H
/* /*
* Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2013 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -107,6 +107,10 @@ extern bool debug_optimizer;
/* Possibly temporary flag to control virtualization of pin arrays */ /* Possibly temporary flag to control virtualization of pin arrays */
extern bool disable_virtual_pins; extern bool disable_virtual_pins;
/* The vlog95 code generator does not want the compiler to generate concat-Z
* LPM objects so this flag is used to block them from being generated. */
extern bool disable_concatz_generation;
/* Limit to size of devirtualized arrays */ /* Limit to size of devirtualized arrays */
extern unsigned long array_size_limit; extern unsigned long array_size_limit;

View File

@ -1,5 +1,5 @@
const char COPYRIGHT[] = const char COPYRIGHT[] =
"Copyright (c) 1998-2012 Stephen Williams (steve@icarus.com)"; "Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)";
/* /*
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -175,6 +175,7 @@ bool debug_optimizer = false;
bool disable_virtual_pins = false; bool disable_virtual_pins = false;
unsigned long array_size_limit = 16777216; // Minimum required by IEEE-1364? unsigned long array_size_limit = 16777216; // Minimum required by IEEE-1364?
unsigned recursive_mod_limit = 10; unsigned recursive_mod_limit = 10;
bool disable_concatz_generation = false;
/* /*
* Verbose messages enabled. * Verbose messages enabled.
@ -967,6 +968,9 @@ int main(int argc, char*argv[])
flag_tmp = flags["RECURSIVE_MOD_LIMIT"]; flag_tmp = flags["RECURSIVE_MOD_LIMIT"];
if (flag_tmp) recursive_mod_limit = strtoul(flag_tmp,NULL,0); if (flag_tmp) recursive_mod_limit = strtoul(flag_tmp,NULL,0);
flag_tmp = flags["DISABLE_CONCATZ_GENERATION"];
if (flag_tmp) disable_concatz_generation = strcmp(flag_tmp,"true")==0;
/* Parse the input. Make the pform. */ /* Parse the input. Make the pform. */
pform_set_timescale(def_ts_units, def_ts_prec, 0, 0); pform_set_timescale(def_ts_units, def_ts_prec, 0, 0);
int rc = pform_parse(argv[optind]); int rc = pform_parse(argv[optind]);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -1127,6 +1127,17 @@ void collapse_partselect_pv_to_concat(Design*des, NetNet*sig)
ivl_assert(*sig, idx == ps_map.size()); ivl_assert(*sig, idx == ps_map.size());
/* The vlog95 and possibly other code generators do not want
* to have a group of part selects turned into a transparent
* concatenation. */
if (disable_concatz_generation) {
// HERE: If the part selects have matching strengths then we can use
// a normal concat with a buf-Z after if the strengths are not
// both strong. We would ideally delete any buf-Z driving the
// concat, but that is not required for the vlog95 generator.
return;
}
// Ah HAH! The NetPartSelect::PV objects exactly cover the // Ah HAH! The NetPartSelect::PV objects exactly cover the
// target signal. We can replace all of them with a single // target signal. We can replace all of them with a single
// concatenation. // concatenation.

View File

@ -888,8 +888,14 @@ static void emit_lpm_as_ca(ivl_scope_t scope, ivl_lpm_t lpm)
emit_nexus_as_ca(scope, ivl_lpm_data(lpm, 1), 0); emit_nexus_as_ca(scope, ivl_lpm_data(lpm, 1), 0);
fprintf(vlog_out, ")"); fprintf(vlog_out, ")");
break; break;
case IVL_LPM_CONCAT: /* A concat-Z should never be generated, but report it as an
* error if one is generated. */
case IVL_LPM_CONCATZ: case IVL_LPM_CONCATZ:
fprintf(stderr, "%s:%u: vlog95 error: Transparent concatenations "
"should not be generated.\n",
ivl_lpm_file(lpm), ivl_lpm_lineno(lpm));
vlog_errors += 1;
case IVL_LPM_CONCAT:
emit_lpm_concat(scope, lpm); emit_lpm_concat(scope, lpm);
break; break;
case IVL_LPM_DIVIDE: case IVL_LPM_DIVIDE:

View File

@ -2,3 +2,4 @@ functor:synth2
functor:synth functor:synth
functor:syn-rules functor:syn-rules
flag:DLL=vlog95.tgt flag:DLL=vlog95.tgt
flag:DISABLE_CONCATZ_GENERATION=true

View File

@ -1 +1,2 @@
flag:DLL=vlog95.tgt flag:DLL=vlog95.tgt
flag:DISABLE_CONCATZ_GENERATION=true