Add variable ps_scan_gates_optimize (default 1). If < 1, then turn off the optimizations in scan_gates.
This commit is contained in:
parent
ed250cc147
commit
b2dac6f121
|
|
@ -570,16 +570,12 @@ static void move_inputs(struct gate_data *curr, struct gate_data *prev)
|
||||||
prev->finished = TRUE;
|
prev->finished = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scan_gates(DSTRING *lhs)
|
static void scan_gates(DSTRING *lhs, int optimize)
|
||||||
{
|
{
|
||||||
struct gate_data *current = NULL, *previous = NULL, *last_curr = NULL;
|
struct gate_data *current = NULL, *previous = NULL, *last_curr = NULL;
|
||||||
struct gate_data *prev = NULL;
|
struct gate_data *prev = NULL;
|
||||||
int ps_scan_gates_noopt = 0;
|
|
||||||
|
|
||||||
if (!cp_getvar("ps_scan_gates_noopt", CP_NUM, &ps_scan_gates_noopt, 0)) {
|
if (optimize < 1) {
|
||||||
ps_scan_gates_noopt = 0;
|
|
||||||
}
|
|
||||||
if (ps_scan_gates_noopt) {
|
|
||||||
current = last_gate;
|
current = last_gate;
|
||||||
if (ds_get_length(lhs) > 0) {
|
if (ds_get_length(lhs) > 0) {
|
||||||
assert(current->finished == FALSE);
|
assert(current->finished == FALSE);
|
||||||
|
|
@ -997,7 +993,7 @@ err_return:
|
||||||
/* Start of logicexp parser */
|
/* Start of logicexp parser */
|
||||||
static void aerror(char *s);
|
static void aerror(char *s);
|
||||||
static BOOL amatch(int t);
|
static BOOL amatch(int t);
|
||||||
static BOOL bparse(char *line, BOOL new_lexer);
|
static BOOL bparse(char *line, BOOL new_lexer, int optimize);
|
||||||
|
|
||||||
static int lookahead = 0;
|
static int lookahead = 0;
|
||||||
static int number_of_instances = 0;
|
static int number_of_instances = 0;
|
||||||
|
|
@ -1092,7 +1088,7 @@ static BOOL amatch(int t)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL bstmt_postfix(void)
|
static BOOL bstmt_postfix(int optimize)
|
||||||
{
|
{
|
||||||
/* A stmt is: output_name_id = '{' expr '}' */
|
/* A stmt is: output_name_id = '{' expr '}' */
|
||||||
DS_CREATE(lhs, 32);
|
DS_CREATE(lhs, 32);
|
||||||
|
|
@ -1144,7 +1140,7 @@ static BOOL bstmt_postfix(void)
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
goto bail_out;
|
goto bail_out;
|
||||||
}
|
}
|
||||||
scan_gates(&lhs);
|
scan_gates(&lhs, optimize);
|
||||||
gen_scanned_gates(first_gate);
|
gen_scanned_gates(first_gate);
|
||||||
lookahead = lex_scan();
|
lookahead = lex_scan();
|
||||||
while (lookahead != '}') {
|
while (lookahead != '}') {
|
||||||
|
|
@ -1187,7 +1183,7 @@ static char *get_logicexp_tmodel_delays(
|
||||||
return ds_get_buf(mname);
|
return ds_get_buf(mname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL bparse(char *line, BOOL new_lexer)
|
static BOOL bparse(char *line, BOOL new_lexer, int optimize)
|
||||||
{
|
{
|
||||||
BOOL ret_val = TRUE;
|
BOOL ret_val = TRUE;
|
||||||
DS_CREATE(stmt, LEX_BUF_SZ);
|
DS_CREATE(stmt, LEX_BUF_SZ);
|
||||||
|
|
@ -1202,7 +1198,7 @@ static BOOL bparse(char *line, BOOL new_lexer)
|
||||||
while (lookahead != '\0') {
|
while (lookahead != '\0') {
|
||||||
ds_clear(&stmt);
|
ds_clear(&stmt);
|
||||||
ds_cat_str(&stmt, parse_lexer->lexer_buf);
|
ds_cat_str(&stmt, parse_lexer->lexer_buf);
|
||||||
if (!bstmt_postfix()) {
|
if (!bstmt_postfix(optimize)) {
|
||||||
cleanup_parser();
|
cleanup_parser();
|
||||||
ret_val= FALSE;
|
ret_val= FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1264,8 +1260,9 @@ static BOOL expect_token(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL f_logicexp(char *line)
|
BOOL f_logicexp(char *line, int optimize)
|
||||||
{
|
{
|
||||||
|
/* If optimize > 0 then perform optimizations in scan_gates */
|
||||||
int t, num_ins = 0, num_outs = 0, i;
|
int t, num_ins = 0, num_outs = 0, i;
|
||||||
char *endp;
|
char *endp;
|
||||||
BOOL ret_val = TRUE;
|
BOOL ret_val = TRUE;
|
||||||
|
|
@ -1350,7 +1347,7 @@ BOOL f_logicexp(char *line)
|
||||||
}
|
}
|
||||||
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
(void) add_sym_tab_entry(parse_lexer->lexer_buf,
|
||||||
SYM_TMODEL, &parse_lexer->lexer_sym_tab);
|
SYM_TMODEL, &parse_lexer->lexer_sym_tab);
|
||||||
ret_val = bparse(line, FALSE);
|
ret_val = bparse(line, FALSE, optimize);
|
||||||
|
|
||||||
current_lexer = NULL;
|
current_lexer = NULL;
|
||||||
if (!ret_val) {
|
if (!ret_val) {
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,7 @@ static int ps_udevice_msgs = 0; // Controls the verbosity of U* warnings
|
||||||
If ps_udevice_exit is non-zero then exit when u_process_instance fails
|
If ps_udevice_exit is non-zero then exit when u_process_instance fails
|
||||||
*/
|
*/
|
||||||
static int ps_udevice_exit = 0;
|
static int ps_udevice_exit = 0;
|
||||||
|
static int ps_scan_gates_optimize = 1; // Allow optimization in scan_gates
|
||||||
static int ps_tpz_delays = 0; // For tristate delays
|
static int ps_tpz_delays = 0; // For tristate delays
|
||||||
static int ps_with_inverters = 0; // For ff/latch control inputs
|
static int ps_with_inverters = 0; // For ff/latch control inputs
|
||||||
static int ps_with_tri_inverters = 0; // For inv3/inv3a data inputs
|
static int ps_with_tri_inverters = 0; // For inv3/inv3a data inputs
|
||||||
|
|
@ -965,6 +966,9 @@ void initialize_udevice(char *subckt_line)
|
||||||
if (!cp_getvar("ps_udevice_exit", CP_NUM, &ps_udevice_exit, 0)) {
|
if (!cp_getvar("ps_udevice_exit", CP_NUM, &ps_udevice_exit, 0)) {
|
||||||
ps_udevice_exit = 0;
|
ps_udevice_exit = 0;
|
||||||
}
|
}
|
||||||
|
if (!cp_getvar("ps_scan_gates_optimize", CP_NUM, &ps_scan_gates_optimize, 0)) {
|
||||||
|
ps_scan_gates_optimize = 1;
|
||||||
|
}
|
||||||
/* If non-zero use inverters with ff/latch control inputs */
|
/* If non-zero use inverters with ff/latch control inputs */
|
||||||
if (!cp_getvar("ps_with_inverters", CP_NUM, &ps_with_inverters, 0)) {
|
if (!cp_getvar("ps_with_inverters", CP_NUM, &ps_with_inverters, 0)) {
|
||||||
ps_with_inverters = 0;
|
ps_with_inverters = 0;
|
||||||
|
|
@ -4318,7 +4322,7 @@ BOOL u_process_instance(char *nline)
|
||||||
if (ps_ports_and_pins & 4) {
|
if (ps_ports_and_pins & 4) {
|
||||||
printf("TRANS_IN %s\n", nline);
|
printf("TRANS_IN %s\n", nline);
|
||||||
}
|
}
|
||||||
behav_ret = f_logicexp(nline);
|
behav_ret = f_logicexp(nline, ps_scan_gates_optimize);
|
||||||
if (!behav_ret && current_subckt) {
|
if (!behav_ret && current_subckt) {
|
||||||
fprintf(stderr, "ERROR in %s\n", current_subckt);
|
fprintf(stderr, "ERROR in %s\n", current_subckt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef INCLUDED_LOGICEXP_H
|
#ifndef INCLUDED_LOGICEXP_H
|
||||||
#define INCLUDED_LOGICEXP_H
|
#define INCLUDED_LOGICEXP_H
|
||||||
|
|
||||||
BOOL f_logicexp(char *line);
|
BOOL f_logicexp(char *line, int optimize);
|
||||||
BOOL f_pindly(char *line);
|
BOOL f_pindly(char *line);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue