Browse Source

Remove debugging asserts.

pre-master-46
Brian Taylor 4 years ago
committed by Holger Vogt
parent
commit
4ce9add137
  1. 32
      src/frontend/udevices.c

32
src/frontend/udevices.c

@ -42,7 +42,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h>
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ngspice/memory.h" #include "ngspice/memory.h"
#include "ngspice/bool.h" #include "ngspice/bool.h"
@ -1357,7 +1356,6 @@ static struct instance_hdr *create_instance_header(char *line)
tmp = TMALLOC(char, strlen(tok) + 1); tmp = TMALLOC(char, strlen(tok) + 1);
strcpy(tmp, tok); strcpy(tmp, tok);
p4 = strchr(tmp, '('); p4 = strchr(tmp, '(');
assert(p4 != NULL);
*p4 = '\0'; *p4 = '\0';
tmp1 = TMALLOC(char, strlen(tmp) + 1); tmp1 = TMALLOC(char, strlen(tmp) + 1);
(void) memcpy(tmp1, tmp, strlen(tmp) + 1); (void) memcpy(tmp1, tmp, strlen(tmp) + 1);
@ -1365,7 +1363,6 @@ static struct instance_hdr *create_instance_header(char *line)
tfree(tmp); tfree(tmp);
p2 = strchr(tok, ')'); p2 = strchr(tok, ')');
assert(p2 != NULL);
p3 = strchr(tok, ','); p3 = strchr(tok, ',');
if (p3) { if (p3) {
hdr->num1 = (int) strtol(p1 + 1, &endp, 10); hdr->num1 = (int) strtol(p1 + 1, &endp, 10);
@ -1762,8 +1759,6 @@ static Xlatorp gen_compound_instance(struct compound_instance *compi)
*/ */
tfree(connector[i]); tfree(connector[i]);
connector[i] = tprintf("%s", tmp); connector[i] = tprintf("%s", tmp);
} else {
assert(FALSE);
} }
} }
/* .model statement for the input gates */ /* .model statement for the input gates */
@ -1834,7 +1829,6 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
num_outs = gip->num_outs; num_outs = gip->num_outs;
enable = gip->enable; enable = gip->enable;
tmodel = gip->tmodel; tmodel = gip->tmodel;
assert(num_gates >= 1);
vector = has_vector_inputs(itype); vector = has_vector_inputs(itype);
for (i = 0; i < num_ins; i++) { for (i = 0; i < num_ins; i++) {
add_input_pin(inarr[i]); add_input_pin(inarr[i]);
@ -1853,23 +1847,18 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
if (num_gates == 1) { if (num_gates == 1) {
char *inst_begin = NULL; char *inst_begin = NULL;
assert(num_outs == 1);
simple_gate = is_gate(itype); simple_gate = is_gate(itype);
tristate_gate = is_tristate(itype); tristate_gate = is_tristate(itype);
if (!simple_gate && !tristate_gate) { return NULL; } if (!simple_gate && !tristate_gate) { return NULL; }
if (simple_gate && tristate_gate) { assert(FALSE); }
add_tristate = FALSE; add_tristate = FALSE;
if (simple_gate) { if (simple_gate) {
assert(!enable);
xspice = find_xspice_for_delay(itype); xspice = find_xspice_for_delay(itype);
} else if (tristate_gate) { } else if (tristate_gate) {
assert(enable);
xspice = find_xspice_for_delay(itype); xspice = find_xspice_for_delay(itype);
if (strcmp(itype, "buf3") != 0) { if (strcmp(itype, "buf3") != 0) {
add_tristate = TRUE; add_tristate = TRUE;
} }
} }
assert(xspice);
xxp = create_xlator(); xxp = create_xlator();
/* Now build the instance name and inputs section */ /* Now build the instance name and inputs section */
if (vector) { if (vector) {
@ -1893,7 +1882,6 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
/* instance name and inputs */ /* instance name and inputs */
/* add the tristate enable if required on original */ /* add the tristate enable if required on original */
if (enable) { if (enable) {
assert(tristate_gate);
if (!add_tristate) { if (!add_tristate) {
/* Warning: changing the format string affects input_buf sz */ /* Warning: changing the format string affects input_buf sz */
inst_begin = tprintf("a%s %s%s%s %s", inst_begin = tprintf("a%s %s%s%s %s",
@ -1983,14 +1971,10 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
int ksave; int ksave;
/* arrays of gates */ /* arrays of gates */
/* NOTE (n)and3a, (n)or3a, (n)xor3a types are not supported */ /* NOTE (n)and3a, (n)or3a, (n)xor3a types are not supported */
assert(num_outs == num_gates);
assert(num_ins == num_gates * width);
simple_array = is_gate_array(itype); simple_array = is_gate_array(itype);
tristate_array = is_tristate_array(itype); tristate_array = is_tristate_array(itype);
add_tristate = FALSE; add_tristate = FALSE;
if (simple_array) { if (simple_array) {
assert(!tristate_array);
assert(!enable);
xspice = find_xspice_for_delay(itype); xspice = find_xspice_for_delay(itype);
} else if (tristate_array) { } else if (tristate_array) {
xspice = find_xspice_for_delay(itype); xspice = find_xspice_for_delay(itype);
@ -1999,12 +1983,7 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
} else if (strcmp(itype, "buf3a") != 0) { } else if (strcmp(itype, "buf3a") != 0) {
return NULL; return NULL;
} }
assert(enable);
assert(!vector);
} else {
assert(FALSE);
} }
assert(xspice);
xxp = create_xlator(); xxp = create_xlator();
k = 0; k = 0;
connector = NULL; connector = NULL;
@ -2075,8 +2054,6 @@ static Xlatorp gen_gate_instance(struct gate_instance *gip)
if (!add_tristate) { if (!add_tristate) {
if (tristate_array) { if (tristate_array) {
assert(strcmp(xspice, "d_tristate") == 0);
assert(strcmp(itype, "buf3a") == 0);
if (i == 0 && !gen_timing_model(tmodel, "utgate", if (i == 0 && !gen_timing_model(tmodel, "utgate",
xspice, primary_model, xxp)) { xspice, primary_model, xxp)) {
printf("WARNING unable to find tmodel %s for %s %s\n", printf("WARNING unable to find tmodel %s for %s %s\n",
@ -2854,12 +2831,11 @@ static struct gate_instance *add_gate_inout_timing_model(
struct instance_hdr *hdr, char *start) struct instance_hdr *hdr, char *start)
{ {
char *tok, *copyline, *itype = hdr->instance_type; char *tok, *copyline, *itype = hdr->instance_type;
int i, n1 = hdr->num1, n2 = hdr->num2, inwidth;
int i, n1 = hdr->num1, inwidth;
BOOL first = TRUE, tristate = FALSE; BOOL first = TRUE, tristate = FALSE;
struct gate_instance *gip = NULL; struct gate_instance *gip = NULL;
char **inarr = NULL, **outarr = NULL, *name; char **inarr = NULL, **outarr = NULL, *name;
assert(n2 == -1);
if (is_vector_gate(itype)) { if (is_vector_gate(itype)) {
inwidth = n1; inwidth = n1;
} else if (is_vector_tristate(itype)) { } else if (is_vector_tristate(itype)) {
@ -2907,7 +2883,6 @@ static struct gate_instance *add_gate_inout_timing_model(
gip->enable = name; gip->enable = name;
} }
/* output */ /* output */
assert(gip->num_outs == 1);
outarr = TMALLOC(char *, gip->num_outs); outarr = TMALLOC(char *, gip->num_outs);
gip->outputs = outarr; gip->outputs = outarr;
tok = strtok(NULL, " \t"); tok = strtok(NULL, " \t");
@ -2978,6 +2953,7 @@ static Xlatorp translate_pull(struct instance_hdr *hdr, char *start)
static Xlatorp translate_ff_latch(struct instance_hdr *hdr, char *start) static Xlatorp translate_ff_latch(struct instance_hdr *hdr, char *start)
{ {
/* If OK return Xlatorp else return NULL */
char *itype; char *itype;
struct dff_instance *dffp = NULL; struct dff_instance *dffp = NULL;
struct jkff_instance *jkffp = NULL; struct jkff_instance *jkffp = NULL;
@ -3007,7 +2983,6 @@ static Xlatorp translate_ff_latch(struct instance_hdr *hdr, char *start)
return xp; return xp;
} }
} else { } else {
assert(FALSE);
return NULL; return NULL;
} }
return NULL; return NULL;
@ -3015,7 +2990,7 @@ static Xlatorp translate_ff_latch(struct instance_hdr *hdr, char *start)
static Xlatorp translate_gate(struct instance_hdr *hdr, char *start) static Xlatorp translate_gate(struct instance_hdr *hdr, char *start)
{ {
/* if unable to translate return 0, else return 1 */
/* If OK return Xlatorp else return NULL */
char *itype; char *itype;
struct gate_instance *igatep; struct gate_instance *igatep;
struct compound_instance *compi; struct compound_instance *compi;
@ -3044,7 +3019,6 @@ static Xlatorp translate_gate(struct instance_hdr *hdr, char *start)
return xp; return xp;
} }
} else { } else {
assert(FALSE);
return NULL; return NULL;
} }
return NULL; return NULL;

Loading…
Cancel
Save