new files
This commit is contained in:
parent
eccc3bbd77
commit
87ccec0e30
|
|
@ -0,0 +1,306 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2010 Tony Bybell.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DEFS_LXTW_H
|
||||
#define DEFS_LXTW_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef WAVE_ALLOCA_H
|
||||
#define WAVE_ALLOCA_H
|
||||
#include <stdlib.h>
|
||||
#include <alloca.h>
|
||||
#define wave_alloca alloca
|
||||
#define LXT2_WR_HDRID (0x1380)
|
||||
#define LXT2_WR_VERSION (0x0001)
|
||||
|
||||
#define LXT2_WR_GRANULE_SIZE (64)
|
||||
#define LXT2_WR_GRANULE_NUM (256)
|
||||
#define LXT2_WR_PARTIAL_SIZE (2048)
|
||||
|
||||
#define LXT2_WR_GRAN_SECT_TIME 0
|
||||
#define LXT2_WR_GRAN_SECT_DICT 1
|
||||
#define LXT2_WR_GRAN_SECT_TIME_PARTIAL 2
|
||||
|
||||
#define LXT2_WR_GZWRITE_BUFFER 4096
|
||||
#define LXT2_WR_SYMPRIME 500009
|
||||
|
||||
typedef uint64_t lxttime_t;
|
||||
|
||||
|
||||
#define LXT2_WR_LLD "%lld"
|
||||
#define LXT2_WR_LLDESC(x) x##LL
|
||||
#define LXT2_WR_ULLDESC(x) x##ULL
|
||||
|
||||
#if LXT2_WR_GRANULE_SIZE > 32
|
||||
typedef unsigned long long granmsk_t;
|
||||
#define LXT2_WR_GRAN_0VAL (LXT2_WR_ULLDESC(0))
|
||||
#define LXT2_WR_GRAN_1VAL (LXT2_WR_ULLDESC(1))
|
||||
#else
|
||||
typedef unsigned int granmsk_t;
|
||||
#define LXT2_WR_GRAN_0VAL (0)
|
||||
#define LXT2_WR_GRAN_1VAL (1)
|
||||
#endif
|
||||
|
||||
|
||||
enum LXT2_WR_Encodings {
|
||||
LXT2_WR_ENC_0,
|
||||
LXT2_WR_ENC_1,
|
||||
LXT2_WR_ENC_INV,
|
||||
LXT2_WR_ENC_LSH0,
|
||||
LXT2_WR_ENC_LSH1,
|
||||
LXT2_WR_ENC_RSH0,
|
||||
LXT2_WR_ENC_RSH1,
|
||||
|
||||
LXT2_WR_ENC_ADD1,
|
||||
LXT2_WR_ENC_ADD2,
|
||||
LXT2_WR_ENC_ADD3,
|
||||
LXT2_WR_ENC_ADD4,
|
||||
|
||||
LXT2_WR_ENC_SUB1,
|
||||
LXT2_WR_ENC_SUB2,
|
||||
LXT2_WR_ENC_SUB3,
|
||||
LXT2_WR_ENC_SUB4,
|
||||
|
||||
LXT2_WR_ENC_X,
|
||||
LXT2_WR_ENC_Z,
|
||||
|
||||
LXT2_WR_ENC_BLACKOUT,
|
||||
|
||||
LXT2_WR_DICT_START
|
||||
};
|
||||
|
||||
/*
|
||||
* integer splay
|
||||
*/
|
||||
typedef struct lxt2_wr_ds_tree_node lxt2_wr_ds_Tree;
|
||||
struct lxt2_wr_ds_tree_node {
|
||||
lxt2_wr_ds_Tree * left, * right;
|
||||
granmsk_t item;
|
||||
int val;
|
||||
lxt2_wr_ds_Tree * next;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* string splay
|
||||
*/
|
||||
typedef struct lxt2_wr_dslxt_tree_node lxt2_wr_dslxt_Tree;
|
||||
struct lxt2_wr_dslxt_tree_node {
|
||||
lxt2_wr_dslxt_Tree * left, * right;
|
||||
char *item;
|
||||
unsigned int val;
|
||||
lxt2_wr_dslxt_Tree * next;
|
||||
};
|
||||
|
||||
|
||||
struct lxt2_wr_trace
|
||||
{
|
||||
FILE *handle;
|
||||
gzFile zhandle;
|
||||
|
||||
lxt2_wr_dslxt_Tree *dict; /* dictionary manipulation */
|
||||
unsigned int num_dict_entries;
|
||||
unsigned int dict_string_mem_required;
|
||||
lxt2_wr_dslxt_Tree *dict_head;
|
||||
lxt2_wr_dslxt_Tree *dict_curr;
|
||||
|
||||
lxt2_wr_ds_Tree *mapdict; /* bitmap compression */
|
||||
unsigned int num_map_entries;
|
||||
lxt2_wr_ds_Tree *mapdict_head;
|
||||
lxt2_wr_ds_Tree *mapdict_curr;
|
||||
|
||||
off_t position;
|
||||
off_t zfacname_predec_size, zfacname_size, zfacgeometry_size;
|
||||
off_t zpackcount, zpackcount_cumulative;
|
||||
off_t current_chunk, current_chunkz;
|
||||
|
||||
struct lxt2_wr_symbol *sym[LXT2_WR_SYMPRIME];
|
||||
struct lxt2_wr_symbol **sorted_facs;
|
||||
struct lxt2_wr_symbol *symchain;
|
||||
int numfacs, numalias;
|
||||
int numfacbytes;
|
||||
int longestname;
|
||||
|
||||
int numsections, numblock;
|
||||
off_t facname_offset, facgeometry_offset;
|
||||
|
||||
lxttime_t mintime, maxtime;
|
||||
unsigned int timegranule;
|
||||
int timescale;
|
||||
int timepos;
|
||||
unsigned int maxgranule;
|
||||
lxttime_t firsttime, lasttime;
|
||||
lxttime_t timetable[LXT2_WR_GRANULE_SIZE];
|
||||
|
||||
unsigned int partial_iter;
|
||||
|
||||
char *compress_fac_str;
|
||||
int compress_fac_len;
|
||||
|
||||
lxttime_t flushtime;
|
||||
unsigned flush_valid : 1;
|
||||
|
||||
unsigned do_strip_brackets : 1;
|
||||
unsigned emitted : 1; /* gate off change field zmode changes when set */
|
||||
unsigned timeset : 1; /* time has been modified from 0..0 */
|
||||
unsigned bumptime : 1; /* says that must go to next time position in granule as value change exists for current time */
|
||||
unsigned granule_dirty : 1; /* for flushing out final block */
|
||||
unsigned blackout : 1; /* blackout on/off */
|
||||
unsigned partial : 1; /* partial (vertical) trace support */
|
||||
unsigned partial_zip : 1; /* partial (vertical) trace support for zip subregions */
|
||||
unsigned no_checkpoint : 1; /* turns off interblock checkpointing */
|
||||
unsigned partial_preference : 1; /* partial preference encountered on some facs */
|
||||
|
||||
char initial_value;
|
||||
|
||||
char zmode[4]; /* fills in with "wb0".."wb9" */
|
||||
unsigned int gzbufpnt;
|
||||
unsigned char gzdest[LXT2_WR_GZWRITE_BUFFER + 4]; /* enough for zlib buffering */
|
||||
|
||||
char *lxtname;
|
||||
off_t break_size;
|
||||
off_t break_header_size;
|
||||
unsigned int break_number;
|
||||
};
|
||||
|
||||
|
||||
struct lxt2_wr_symbol
|
||||
{
|
||||
struct lxt2_wr_symbol *next;
|
||||
struct lxt2_wr_symbol *symchain;
|
||||
char *name;
|
||||
int namlen;
|
||||
|
||||
int facnum;
|
||||
struct lxt2_wr_symbol *aliased_to;
|
||||
|
||||
char *value; /* fac's actual value */
|
||||
|
||||
unsigned int rows;
|
||||
int msb, lsb;
|
||||
int len;
|
||||
int flags;
|
||||
|
||||
unsigned partial_preference : 1; /* in order to shove nets to the first partial group */
|
||||
|
||||
unsigned int chgpos;
|
||||
granmsk_t msk; /* must contain LXT2_WR_GRANULE_SIZE bits! */
|
||||
unsigned int chg[LXT2_WR_GRANULE_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#define LXT2_WR_SYM_F_BITS (0)
|
||||
#define LXT2_WR_SYM_F_INTEGER (1<<0)
|
||||
#define LXT2_WR_SYM_F_DOUBLE (1<<1)
|
||||
#define LXT2_WR_SYM_F_STRING (1<<2)
|
||||
#define LXT2_WR_SYM_F_TIME (LXT2_WR_SYM_F_STRING) /* user must correctly format this as a string */
|
||||
#define LXT2_WR_SYM_F_ALIAS (1<<3)
|
||||
|
||||
#define LXT2_WR_SYM_F_SIGNED (1<<4)
|
||||
#define LXT2_WR_SYM_F_BOOLEAN (1<<5)
|
||||
#define LXT2_WR_SYM_F_NATURAL ((1<<6)|(LXT2_WR_SYM_F_INTEGER))
|
||||
#define LXT2_WR_SYM_F_POSITIVE ((1<<7)|(LXT2_WR_SYM_F_INTEGER))
|
||||
#define LXT2_WR_SYM_F_CHARACTER (1<<8)
|
||||
|
||||
#define LXT2_WR_SYM_F_CONSTANT (1<<9)
|
||||
#define LXT2_WR_SYM_F_VARIABLE (1<<10)
|
||||
#define LXT2_WR_SYM_F_SIGNAL (1<<11)
|
||||
|
||||
#define LXT2_WR_SYM_F_IN (1<<12)
|
||||
#define LXT2_WR_SYM_F_OUT (1<<13)
|
||||
#define LXT2_WR_SYM_F_INOUT (1<<14)
|
||||
|
||||
#define LXT2_WR_SYM_F_WIRE (1<<15)
|
||||
#define LXT2_WR_SYM_F_REG (1<<16)
|
||||
|
||||
void lxt2_init(void *plotPtr);
|
||||
void lxt2_end(void *plotPtr);
|
||||
|
||||
/* file I/O */
|
||||
struct lxt2_wr_trace * lxt2_wr_init(const char *name);
|
||||
void lxt2_wr_flush(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_close(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* for dealing with very large traces, split into multiple files approximately "siz" in length */
|
||||
void lxt2_wr_set_break_size(struct lxt2_wr_trace *lt, off_t siz);
|
||||
|
||||
/* 0 = no compression, 9 = best compression, 4 = default */
|
||||
void lxt2_wr_set_compression_depth(struct lxt2_wr_trace *lt, unsigned int depth);
|
||||
|
||||
/* default is partial off, turning on makes for faster trace reads, nonzero zipmode causes vertical compression */
|
||||
void lxt2_wr_set_partial_off(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_partial_on(struct lxt2_wr_trace *lt, int zipmode);
|
||||
void lxt2_wr_set_partial_preference(struct lxt2_wr_trace *lt, const char *name);
|
||||
|
||||
/* turning off checkpointing makes for smaller files */
|
||||
void lxt2_wr_set_checkpoint_off(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_checkpoint_on(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* facility creation */
|
||||
void lxt2_wr_set_initial_value(struct lxt2_wr_trace *lt, char value);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_find(struct lxt2_wr_trace *lt, const char *name);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_add(struct lxt2_wr_trace *lt, const char *name, unsigned int rows, int msb, int lsb, int flags);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_alias(struct lxt2_wr_trace *lt, const char *existing_name, const char *alias, int msb, int lsb);
|
||||
void lxt2_wr_symbol_bracket_stripping(struct lxt2_wr_trace *lt, int doit);
|
||||
|
||||
/* each granule is LXT2_WR_GRANULE_SIZE (32 or 64) timesteps, default is 256 per section */
|
||||
void lxt2_wr_set_maxgranule(struct lxt2_wr_trace *lt, unsigned int maxgranule);
|
||||
|
||||
/* time ops */
|
||||
void lxt2_wr_set_timescale(struct lxt2_wr_trace *lt, int timescale);
|
||||
int lxt2_wr_set_time(struct lxt2_wr_trace *lt, unsigned int timeval);
|
||||
int lxt2_wr_inc_time_by_delta(struct lxt2_wr_trace *lt, unsigned int timeval);
|
||||
int lxt2_wr_set_time64(struct lxt2_wr_trace *lt, lxttime_t timeval);
|
||||
int lxt2_wr_inc_time_by_delta64(struct lxt2_wr_trace *lt, lxttime_t timeval);
|
||||
|
||||
/* allows blackout regions in LXT files */
|
||||
void lxt2_wr_set_dumpoff(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_dumpon(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* left fill on bit_string uses vcd semantics (left fill with value[0] unless value[0]=='1', then use '0') */
|
||||
int lxt2_wr_emit_value_int(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, int value);
|
||||
int lxt2_wr_emit_value_double(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, double value);
|
||||
int lxt2_wr_emit_value_string(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, char *value);
|
||||
int lxt2_wr_emit_value_bit_string(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, char *value);
|
||||
|
||||
typedef struct lxt2_s {
|
||||
struct lxt2_wr_trace *file;
|
||||
struct lxt2_wr_symbol **evt_table;
|
||||
int *evt_indexmap;
|
||||
int evt_num;
|
||||
struct lxt2_wr_symbol **kvl_table;
|
||||
int *kvl_indexmap;
|
||||
int kvl_num;
|
||||
} lxt2_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
#include "ngspice/ngspice.h"
|
||||
#include "ngspice/config.h"
|
||||
#include "ngspice/cktdefs.h"
|
||||
//#include "ngspice/cktaccept.h"
|
||||
#include "ngspice/trandefs.h"
|
||||
#include "ngspice/sperror.h"
|
||||
#include "ngspice/fteext.h"
|
||||
#include "ngspice/missing_math.h"
|
||||
#include "../frontend/outitf.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef XSPICE
|
||||
/* gtri - add - wbk - Add headers */
|
||||
#include "ngspice/miftypes.h"
|
||||
|
||||
#include "ngspice/evt.h"
|
||||
#include "ngspice/mif.h"
|
||||
#include "ngspice/evtproto.h"
|
||||
#include "ngspice/ipctiein.h"
|
||||
/* gtri - end - wbk - Add headers */
|
||||
#endif
|
||||
|
||||
#include "ngspice/lxt2_write.h"
|
||||
|
||||
#ifdef CLUSTER
|
||||
#include "cluster.h"
|
||||
#endif
|
||||
|
||||
#define CKALLOC(var,size,type) \
|
||||
if(size) { \
|
||||
if(!(var = (type *) MALLOC((size) * sizeof(type)))) \
|
||||
return(E_NOMEM); \
|
||||
}
|
||||
|
||||
void CKTemitlxt2(void *plotPtr)
|
||||
{
|
||||
runDesc *run = (runDesc *) plotPtr;
|
||||
struct lxt2_wr_symbol **trace_table;
|
||||
struct lxt2_wr_symbol *trace;
|
||||
char *name;
|
||||
double value;
|
||||
static unsigned int last_set_time, set_time;
|
||||
static double time_resolution=1.0e-9;
|
||||
int i,trace_num;
|
||||
int *trace_index;
|
||||
CKTcircuit *ckt;
|
||||
IFvalue valData;
|
||||
|
||||
ckt=run->circuit;
|
||||
trace_table = run->circuit->lxt2.kvl_table;
|
||||
trace_num = ckt->lxt2.kvl_num;
|
||||
trace_index = ckt->lxt2.kvl_indexmap;
|
||||
|
||||
valData.v.numValue = ckt->CKTmaxEqNum-1;
|
||||
valData.v.vec.rVec = ckt->CKTrhsOld+1;
|
||||
|
||||
if(ckt->CKTtime <= 0.0) {
|
||||
time_resolution=(double)pow(10.0,(double)LXT2_TIME_RESOLUTION_EXPONENT);
|
||||
last_set_time = 0;
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 CKTemitlxt2 set time (%g) (%d)\n", ckt->CKTtime,last_set_time);
|
||||
#endif
|
||||
lxt2_wr_set_time(ckt->lxt2.file, last_set_time);
|
||||
}
|
||||
set_time = (unsigned int)(ckt->CKTtime/time_resolution);
|
||||
if(set_time > last_set_time) {
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 CKTemitlxt2 set time (%g) (%d)\n", ckt->CKTtime,set_time);
|
||||
#endif
|
||||
lxt2_wr_set_time(ckt->lxt2.file, set_time);
|
||||
last_set_time = set_time;
|
||||
}
|
||||
for(i = 0; i < trace_num; i++) {
|
||||
if(trace_index[i] > 0) {
|
||||
trace=(struct lxt2_wr_symbol *)(trace_table[i]);
|
||||
if(trace!=NULL) {
|
||||
value = valData.v.vec.rVec[run->data[trace_index[i]].outIndex];
|
||||
name = run->data[trace_index[i]].name;
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 cktlxt2.c:trace(%p) emit double (%s)->(%g)\n",&trace,name,value);
|
||||
#endif
|
||||
lxt2_wr_emit_value_double(ckt->lxt2.file,trace,0,value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 cktlxt2.c: flush ckt.tracelxt2\n");
|
||||
#endif
|
||||
lxt2_wr_flush(ckt->lxt2.file);
|
||||
}
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
#include "ngspice/ngspice.h"
|
||||
#include "ngspice/config.h"
|
||||
#include "ngspice/cktdefs.h"
|
||||
//#include "ngspice/cktaccept.h"
|
||||
#include "ngspice/trandefs.h"
|
||||
#include "ngspice/sperror.h"
|
||||
#include "ngspice/fteext.h"
|
||||
#include "ngspice/missing_math.h"
|
||||
#include "../frontend/outitf.h"
|
||||
|
||||
#ifdef XSPICE
|
||||
/* gtri - add - wbk - Add headers */
|
||||
#include "ngspice/miftypes.h"
|
||||
|
||||
#include "ngspice/evt.h"
|
||||
#include "ngspice/mif.h"
|
||||
#include "ngspice/evtproto.h"
|
||||
#include "ngspice/ipctiein.h"
|
||||
/* gtri - end - wbk - Add headers */
|
||||
#endif
|
||||
|
||||
#include "ngspice/lxt2_write.h"
|
||||
|
||||
#ifdef CLUSTER
|
||||
#include "cluster.h"
|
||||
#endif
|
||||
|
||||
#define CKALLOC(var,size,type) \
|
||||
if(size) { \
|
||||
if(!(var = (type *) MALLOC((size) * sizeof(type)))) \
|
||||
return(E_NOMEM); \
|
||||
}
|
||||
|
||||
static void EVTtraceinit(CKTcircuit *ckt);
|
||||
static void KVLtraceinit(void *plotPtr);
|
||||
|
||||
void lxt2_init(void *plotPtr) {
|
||||
runDesc *run = (runDesc *)plotPtr;
|
||||
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 lxt2_init\n");
|
||||
#endif
|
||||
|
||||
if(run && run->circuit) {
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 run and run->circuit exist\n");
|
||||
printf("\nLXT2 run->name(%s)\n",run->name);
|
||||
printf("\nLXT2 Spice_Path(%s)\n",Spice_Path);
|
||||
#endif
|
||||
run->circuit->lxt2.file = lxt2_wr_init("waveforms.lxt");
|
||||
lxt2_wr_set_timescale(run->circuit->lxt2.file, LXT2_TIME_RESOLUTION_EXPONENT);
|
||||
printf("LXT2 time resolution is 1.0e%d seconds.\n\n",LXT2_TIME_RESOLUTION_EXPONENT);
|
||||
fflush(stdout);
|
||||
EVTtraceinit(run->circuit);
|
||||
KVLtraceinit(run);
|
||||
}
|
||||
}
|
||||
|
||||
void lxt2_end(void *plotPtr)
|
||||
{
|
||||
runDesc *run = (runDesc *) plotPtr;
|
||||
if(run && run->circuit) {
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 final file flush.\n");
|
||||
#endif
|
||||
lxt2_wr_flush(run->circuit->lxt2.file);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 close file.\n");
|
||||
#endif
|
||||
lxt2_wr_close(run->circuit->lxt2.file);
|
||||
free(run->circuit->lxt2.evt_table);
|
||||
free(run->circuit->lxt2.evt_indexmap);
|
||||
free(run->circuit->lxt2.kvl_table);
|
||||
free(run->circuit->lxt2.kvl_indexmap);
|
||||
}
|
||||
}
|
||||
|
||||
static void EVTtraceinit(CKTcircuit *ckt) /* the circuit structure */
|
||||
{
|
||||
|
||||
struct lxt2_wr_symbol **trace_table = NULL; /* holmes: vector of pointer to traces in lxt2 output file */
|
||||
Evt_Node_Info_t **node_table;
|
||||
int i;
|
||||
int num_nodes;
|
||||
|
||||
node_table = ckt->evt->info.node_table;;
|
||||
num_nodes = ckt->evt->counts.num_nodes;
|
||||
|
||||
int *evt_indexmap = NULL;
|
||||
|
||||
/* holmes: Allocate and initialize table of lxt2 evt trace pointers */
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 Allocate trace_table\n");
|
||||
#endif
|
||||
CKALLOC(trace_table, num_nodes, struct lxt2_wr_symbol *);
|
||||
CKALLOC(evt_indexmap, num_nodes, int);
|
||||
for(i = 0; i < num_nodes; i++) {
|
||||
evt_indexmap[i] = i;
|
||||
switch(node_table[i]->udn_index)
|
||||
{
|
||||
case 0: /* Bit */
|
||||
trace_table[i] = lxt2_wr_symbol_add(ckt->lxt2.file, node_table[i]->name, 0, 0, 0, LXT2_WR_SYM_F_BITS);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 created EVT BIT trace_table[%d] pointer(%p) name(%s)\n",i,&trace_table[i],node_table[i]->name);
|
||||
#endif
|
||||
break;
|
||||
case 1: /* Integer */
|
||||
trace_table[i] = lxt2_wr_symbol_add(ckt->lxt2.file, node_table[i]->name, 0, 0, 0, LXT2_WR_SYM_F_INTEGER);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 created EVT INT trace_table[%d] pointer(%p) name(%s)\n",i,&trace_table[i],node_table[i]->name);
|
||||
#endif
|
||||
break;
|
||||
case 2: /* Double */
|
||||
trace_table[i] = lxt2_wr_symbol_add(ckt->lxt2.file, node_table[i]->name, 0, 0, 0, LXT2_WR_SYM_F_DOUBLE);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 created EVT DUB trace_table[%d] pointer(%p) name(%s)\n",i,&trace_table[i],node_table[i]->name);
|
||||
#endif
|
||||
break;
|
||||
default: /* Bit */
|
||||
trace_table[i] = lxt2_wr_symbol_add(ckt->lxt2.file, node_table[i]->name, 0, 0, 0, LXT2_WR_SYM_F_BITS);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 created EVT BIT trace_table[%d] pointer(%p) name(%s)\n",i,&trace_table[i],node_table[i]->name);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
fflush(stdout);
|
||||
ckt->lxt2.evt_indexmap = evt_indexmap;
|
||||
ckt->lxt2.evt_table = trace_table;
|
||||
ckt->lxt2.evt_num = num_nodes;
|
||||
}
|
||||
|
||||
static void KVLtraceinit(void *plotPtr) /* Call this after OUTpBeginPlot after all electrical run data is loaded */
|
||||
{
|
||||
runDesc *run = (runDesc *) plotPtr;
|
||||
struct lxt2_wr_symbol **trace_table = NULL;
|
||||
int *kvl_indexmap = NULL;
|
||||
int i;
|
||||
if(run->circuit) {
|
||||
CKALLOC(trace_table, run->numData, struct lxt2_wr_symbol *);
|
||||
CKALLOC(kvl_indexmap, run->numData, int);
|
||||
for(i = 0; i < run->numData; i++) {
|
||||
kvl_indexmap[i] = -1;
|
||||
trace_table[i] = NULL;
|
||||
if (run->data[i].outIndex != -1) { /* Skip over the time vector. Once we parse the saves list this check won't be necessary. */
|
||||
if (run->data[i].regular) { /* Check that the data is not "special" like a parameter, might allow this later */
|
||||
if (run->data[i].type == IF_REAL) { /* As opposed to being complex */
|
||||
kvl_indexmap[i] = i;
|
||||
trace_table[i] = lxt2_wr_symbol_add(run->circuit->lxt2.file, run->data[i].name, 0, 0, 0, LXT2_WR_SYM_F_DOUBLE);
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 created KVL DUB trace_table[%d] pointer(%p) name(%s)\n",i,&trace_table[i],run->data[i].name);
|
||||
#endif
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
run->circuit->lxt2.kvl_indexmap = kvl_indexmap;
|
||||
run->circuit->lxt2.kvl_table = trace_table;
|
||||
run->circuit->lxt2.kvl_num = run->numData;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,294 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2010 Tony Bybell.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DEFS_LXTW_H
|
||||
#define DEFS_LXTW_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef WAVE_ALLOCA_H
|
||||
#define WAVE_ALLOCA_H
|
||||
#include <stdlib.h>
|
||||
#include <alloca.h>
|
||||
#define wave_alloca alloca
|
||||
#define LXT2_WR_HDRID (0x1380)
|
||||
#define LXT2_WR_VERSION (0x0001)
|
||||
|
||||
#define LXT2_WR_GRANULE_SIZE (64)
|
||||
#define LXT2_WR_GRANULE_NUM (256)
|
||||
#define LXT2_WR_PARTIAL_SIZE (2048)
|
||||
|
||||
#define LXT2_WR_GRAN_SECT_TIME 0
|
||||
#define LXT2_WR_GRAN_SECT_DICT 1
|
||||
#define LXT2_WR_GRAN_SECT_TIME_PARTIAL 2
|
||||
|
||||
#define LXT2_WR_GZWRITE_BUFFER 4096
|
||||
#define LXT2_WR_SYMPRIME 500009
|
||||
|
||||
typedef uint64_t lxttime_t;
|
||||
|
||||
|
||||
#define LXT2_WR_LLD "%lld"
|
||||
#define LXT2_WR_LLDESC(x) x##LL
|
||||
#define LXT2_WR_ULLDESC(x) x##ULL
|
||||
|
||||
#if LXT2_WR_GRANULE_SIZE > 32
|
||||
typedef unsigned long long granmsk_t;
|
||||
#define LXT2_WR_GRAN_0VAL (LXT2_WR_ULLDESC(0))
|
||||
#define LXT2_WR_GRAN_1VAL (LXT2_WR_ULLDESC(1))
|
||||
#else
|
||||
typedef unsigned int granmsk_t;
|
||||
#define LXT2_WR_GRAN_0VAL (0)
|
||||
#define LXT2_WR_GRAN_1VAL (1)
|
||||
#endif
|
||||
|
||||
|
||||
enum LXT2_WR_Encodings {
|
||||
LXT2_WR_ENC_0,
|
||||
LXT2_WR_ENC_1,
|
||||
LXT2_WR_ENC_INV,
|
||||
LXT2_WR_ENC_LSH0,
|
||||
LXT2_WR_ENC_LSH1,
|
||||
LXT2_WR_ENC_RSH0,
|
||||
LXT2_WR_ENC_RSH1,
|
||||
|
||||
LXT2_WR_ENC_ADD1,
|
||||
LXT2_WR_ENC_ADD2,
|
||||
LXT2_WR_ENC_ADD3,
|
||||
LXT2_WR_ENC_ADD4,
|
||||
|
||||
LXT2_WR_ENC_SUB1,
|
||||
LXT2_WR_ENC_SUB2,
|
||||
LXT2_WR_ENC_SUB3,
|
||||
LXT2_WR_ENC_SUB4,
|
||||
|
||||
LXT2_WR_ENC_X,
|
||||
LXT2_WR_ENC_Z,
|
||||
|
||||
LXT2_WR_ENC_BLACKOUT,
|
||||
|
||||
LXT2_WR_DICT_START
|
||||
};
|
||||
|
||||
/*
|
||||
* integer splay
|
||||
*/
|
||||
typedef struct lxt2_wr_ds_tree_node lxt2_wr_ds_Tree;
|
||||
struct lxt2_wr_ds_tree_node {
|
||||
lxt2_wr_ds_Tree * left, * right;
|
||||
granmsk_t item;
|
||||
int val;
|
||||
lxt2_wr_ds_Tree * next;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* string splay
|
||||
*/
|
||||
typedef struct lxt2_wr_dslxt_tree_node lxt2_wr_dslxt_Tree;
|
||||
struct lxt2_wr_dslxt_tree_node {
|
||||
lxt2_wr_dslxt_Tree * left, * right;
|
||||
char *item;
|
||||
unsigned int val;
|
||||
lxt2_wr_dslxt_Tree * next;
|
||||
};
|
||||
|
||||
|
||||
struct lxt2_wr_trace
|
||||
{
|
||||
FILE *handle;
|
||||
gzFile zhandle;
|
||||
|
||||
lxt2_wr_dslxt_Tree *dict; /* dictionary manipulation */
|
||||
unsigned int num_dict_entries;
|
||||
unsigned int dict_string_mem_required;
|
||||
lxt2_wr_dslxt_Tree *dict_head;
|
||||
lxt2_wr_dslxt_Tree *dict_curr;
|
||||
|
||||
lxt2_wr_ds_Tree *mapdict; /* bitmap compression */
|
||||
unsigned int num_map_entries;
|
||||
lxt2_wr_ds_Tree *mapdict_head;
|
||||
lxt2_wr_ds_Tree *mapdict_curr;
|
||||
|
||||
off_t position;
|
||||
off_t zfacname_predec_size, zfacname_size, zfacgeometry_size;
|
||||
off_t zpackcount, zpackcount_cumulative;
|
||||
off_t current_chunk, current_chunkz;
|
||||
|
||||
struct lxt2_wr_symbol *sym[LXT2_WR_SYMPRIME];
|
||||
struct lxt2_wr_symbol **sorted_facs;
|
||||
struct lxt2_wr_symbol *symchain;
|
||||
int numfacs, numalias;
|
||||
int numfacbytes;
|
||||
int longestname;
|
||||
|
||||
int numsections, numblock;
|
||||
off_t facname_offset, facgeometry_offset;
|
||||
|
||||
lxttime_t mintime, maxtime;
|
||||
unsigned int timegranule;
|
||||
int timescale;
|
||||
int timepos;
|
||||
unsigned int maxgranule;
|
||||
lxttime_t firsttime, lasttime;
|
||||
lxttime_t timetable[LXT2_WR_GRANULE_SIZE];
|
||||
|
||||
unsigned int partial_iter;
|
||||
|
||||
char *compress_fac_str;
|
||||
int compress_fac_len;
|
||||
|
||||
lxttime_t flushtime;
|
||||
unsigned flush_valid : 1;
|
||||
|
||||
unsigned do_strip_brackets : 1;
|
||||
unsigned emitted : 1; /* gate off change field zmode changes when set */
|
||||
unsigned timeset : 1; /* time has been modified from 0..0 */
|
||||
unsigned bumptime : 1; /* says that must go to next time position in granule as value change exists for current time */
|
||||
unsigned granule_dirty : 1; /* for flushing out final block */
|
||||
unsigned blackout : 1; /* blackout on/off */
|
||||
unsigned partial : 1; /* partial (vertical) trace support */
|
||||
unsigned partial_zip : 1; /* partial (vertical) trace support for zip subregions */
|
||||
unsigned no_checkpoint : 1; /* turns off interblock checkpointing */
|
||||
unsigned partial_preference : 1; /* partial preference encountered on some facs */
|
||||
|
||||
char initial_value;
|
||||
|
||||
char zmode[4]; /* fills in with "wb0".."wb9" */
|
||||
unsigned int gzbufpnt;
|
||||
unsigned char gzdest[LXT2_WR_GZWRITE_BUFFER + 4]; /* enough for zlib buffering */
|
||||
|
||||
char *lxtname;
|
||||
off_t break_size;
|
||||
off_t break_header_size;
|
||||
unsigned int break_number;
|
||||
};
|
||||
|
||||
|
||||
struct lxt2_wr_symbol
|
||||
{
|
||||
struct lxt2_wr_symbol *next;
|
||||
struct lxt2_wr_symbol *symchain;
|
||||
char *name;
|
||||
int namlen;
|
||||
|
||||
int facnum;
|
||||
struct lxt2_wr_symbol *aliased_to;
|
||||
|
||||
char *value; /* fac's actual value */
|
||||
|
||||
unsigned int rows;
|
||||
int msb, lsb;
|
||||
int len;
|
||||
int flags;
|
||||
|
||||
unsigned partial_preference : 1; /* in order to shove nets to the first partial group */
|
||||
|
||||
unsigned int chgpos;
|
||||
granmsk_t msk; /* must contain LXT2_WR_GRANULE_SIZE bits! */
|
||||
unsigned int chg[LXT2_WR_GRANULE_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#define LXT2_WR_SYM_F_BITS (0)
|
||||
#define LXT2_WR_SYM_F_INTEGER (1<<0)
|
||||
#define LXT2_WR_SYM_F_DOUBLE (1<<1)
|
||||
#define LXT2_WR_SYM_F_STRING (1<<2)
|
||||
#define LXT2_WR_SYM_F_TIME (LXT2_WR_SYM_F_STRING) /* user must correctly format this as a string */
|
||||
#define LXT2_WR_SYM_F_ALIAS (1<<3)
|
||||
|
||||
#define LXT2_WR_SYM_F_SIGNED (1<<4)
|
||||
#define LXT2_WR_SYM_F_BOOLEAN (1<<5)
|
||||
#define LXT2_WR_SYM_F_NATURAL ((1<<6)|(LXT2_WR_SYM_F_INTEGER))
|
||||
#define LXT2_WR_SYM_F_POSITIVE ((1<<7)|(LXT2_WR_SYM_F_INTEGER))
|
||||
#define LXT2_WR_SYM_F_CHARACTER (1<<8)
|
||||
|
||||
#define LXT2_WR_SYM_F_CONSTANT (1<<9)
|
||||
#define LXT2_WR_SYM_F_VARIABLE (1<<10)
|
||||
#define LXT2_WR_SYM_F_SIGNAL (1<<11)
|
||||
|
||||
#define LXT2_WR_SYM_F_IN (1<<12)
|
||||
#define LXT2_WR_SYM_F_OUT (1<<13)
|
||||
#define LXT2_WR_SYM_F_INOUT (1<<14)
|
||||
|
||||
#define LXT2_WR_SYM_F_WIRE (1<<15)
|
||||
#define LXT2_WR_SYM_F_REG (1<<16)
|
||||
|
||||
|
||||
/* file I/O */
|
||||
struct lxt2_wr_trace * lxt2_wr_init(const char *name);
|
||||
void lxt2_wr_flush(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_close(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* for dealing with very large traces, split into multiple files approximately "siz" in length */
|
||||
void lxt2_wr_set_break_size(struct lxt2_wr_trace *lt, off_t siz);
|
||||
|
||||
/* 0 = no compression, 9 = best compression, 4 = default */
|
||||
void lxt2_wr_set_compression_depth(struct lxt2_wr_trace *lt, unsigned int depth);
|
||||
|
||||
/* default is partial off, turning on makes for faster trace reads, nonzero zipmode causes vertical compression */
|
||||
void lxt2_wr_set_partial_off(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_partial_on(struct lxt2_wr_trace *lt, int zipmode);
|
||||
void lxt2_wr_set_partial_preference(struct lxt2_wr_trace *lt, const char *name);
|
||||
|
||||
/* turning off checkpointing makes for smaller files */
|
||||
void lxt2_wr_set_checkpoint_off(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_checkpoint_on(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* facility creation */
|
||||
void lxt2_wr_set_initial_value(struct lxt2_wr_trace *lt, char value);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_find(struct lxt2_wr_trace *lt, const char *name);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_add(struct lxt2_wr_trace *lt, const char *name, unsigned int rows, int msb, int lsb, int flags);
|
||||
struct lxt2_wr_symbol * lxt2_wr_symbol_alias(struct lxt2_wr_trace *lt, const char *existing_name, const char *alias, int msb, int lsb);
|
||||
void lxt2_wr_symbol_bracket_stripping(struct lxt2_wr_trace *lt, int doit);
|
||||
|
||||
/* each granule is LXT2_WR_GRANULE_SIZE (32 or 64) timesteps, default is 256 per section */
|
||||
void lxt2_wr_set_maxgranule(struct lxt2_wr_trace *lt, unsigned int maxgranule);
|
||||
|
||||
/* time ops */
|
||||
void lxt2_wr_set_timescale(struct lxt2_wr_trace *lt, int timescale);
|
||||
int lxt2_wr_set_time(struct lxt2_wr_trace *lt, unsigned int timeval);
|
||||
int lxt2_wr_inc_time_by_delta(struct lxt2_wr_trace *lt, unsigned int timeval);
|
||||
int lxt2_wr_set_time64(struct lxt2_wr_trace *lt, lxttime_t timeval);
|
||||
int lxt2_wr_inc_time_by_delta64(struct lxt2_wr_trace *lt, lxttime_t timeval);
|
||||
|
||||
/* allows blackout regions in LXT files */
|
||||
void lxt2_wr_set_dumpoff(struct lxt2_wr_trace *lt);
|
||||
void lxt2_wr_set_dumpon(struct lxt2_wr_trace *lt);
|
||||
|
||||
/* left fill on bit_string uses vcd semantics (left fill with value[0] unless value[0]=='1', then use '0') */
|
||||
int lxt2_wr_emit_value_int(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, int value);
|
||||
int lxt2_wr_emit_value_double(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, double value);
|
||||
int lxt2_wr_emit_value_string(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, char *value);
|
||||
int lxt2_wr_emit_value_bit_string(struct lxt2_wr_trace *lt, struct lxt2_wr_symbol *s, unsigned int row, char *value);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
#include "ngspice/ngspice.h"
|
||||
#include "ngspice/cktdefs.h"
|
||||
//#include "util.h"
|
||||
|
||||
#include "ngspice/mif.h"
|
||||
#include "ngspice/evt.h"
|
||||
#include "ngspice/evtudn.h"
|
||||
|
||||
#include "ngspice/mifproto.h"
|
||||
#include "ngspice/evtproto.h"
|
||||
#include "ngspice/cm.h"
|
||||
#include <math.h>
|
||||
|
||||
static char *EVTbitmap(int i);
|
||||
|
||||
/*
|
||||
EVTemitlxt2
|
||||
|
||||
|
||||
This function emits a evt value into an lxt2 change-on-event file stream. (holmes)
|
||||
|
||||
*/
|
||||
|
||||
void EVTemitlxt2(
|
||||
CKTcircuit *ckt, /* The circuit structure */
|
||||
int node_index, /* The node to copy */
|
||||
Evt_Node_t *from) /* Location to copy from */
|
||||
{
|
||||
static unsigned int last_set_time;
|
||||
static double time_resolution=-1.0;
|
||||
unsigned int set_time;
|
||||
int type;
|
||||
char *name;
|
||||
/* Mif_Boolean_t invert; */
|
||||
|
||||
Evt_Node_Info_t **node_table;
|
||||
struct lxt2_wr_symbol **trace_table;
|
||||
struct lxt2_wr_symbol *trace;
|
||||
|
||||
node_table = ckt->evt->info.node_table;
|
||||
trace_table = ckt->lxt2.evt_table;
|
||||
|
||||
type = node_table[node_index]->udn_index;
|
||||
name = node_table[node_index]->name;
|
||||
|
||||
if(time_resolution<0.0) {
|
||||
time_resolution=(double)pow(10.0,(double)LXT2_TIME_RESOLUTION_EXPONENT);
|
||||
last_set_time=0;
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 time_resolution (%g) last_time(%d)\n", time_resolution,last_set_time);
|
||||
#endif
|
||||
}
|
||||
set_time = (unsigned int)(ckt->CKTtime/time_resolution);
|
||||
if(set_time > last_set_time) {
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 set time (%g) (%d)\n", ckt->CKTtime,set_time);
|
||||
#endif
|
||||
lxt2_wr_set_time(ckt->lxt2.file, set_time);
|
||||
last_set_time = set_time;
|
||||
}
|
||||
|
||||
trace=(struct lxt2_wr_symbol *)(trace_table[node_index]);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case 0: /* Bit */
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c:trace(%p) emit bit (%s)->(%s)\n",trace,name,(char *)EVTbitmap(*((int *)(from->node_value))));
|
||||
#endif
|
||||
if(lxt2_wr_emit_value_bit_string(ckt->lxt2.file,trace,0,(char *)EVTbitmap(*((int *)(from->node_value))))==0) {
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c:trace(%p) emit bit (%s)->(%s) SUCCESS\n",&trace,name,(char *)EVTbitmap(*((int *)(from->node_value))));
|
||||
#endif
|
||||
};
|
||||
break;
|
||||
case 1: /* Integer */
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c:trace(%p) emit int (%s)->(%d)\n",trace,name,*((int *)(from->node_value)));
|
||||
#endif
|
||||
lxt2_wr_emit_value_int(ckt->lxt2.file,trace,0,*((int *)(from->node_value)));
|
||||
break;
|
||||
case 2: /* Double */
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c:trace(%p) emit double (%s)->(%g)\n",trace,name,*((double *)(from->node_value)));
|
||||
#endif
|
||||
lxt2_wr_emit_value_double(ckt->lxt2.file,trace,0,*((double *)(from->node_value)));
|
||||
break;
|
||||
default: /* Bit */
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c:trace(%p) emit bit (%s)->(%s)\n",trace,name,(char *)EVTbitmap(*((int *)(from->node_value))));
|
||||
#endif
|
||||
lxt2_wr_emit_value_bit_string(ckt->lxt2.file,trace,0,(char *)EVTbitmap(*((int *)(from->node_value))));
|
||||
break;
|
||||
}
|
||||
#ifdef LXT2_DEBUG
|
||||
printf("LXT2 evtlxt2.c: flush ckt.tracelxt2\n");
|
||||
#endif
|
||||
lxt2_wr_flush(ckt->lxt2.file);
|
||||
|
||||
}
|
||||
|
||||
static char *EVTbitmap(int i)
|
||||
{
|
||||
static char s[2];
|
||||
char *p = s;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
*(p++) = '0';
|
||||
break;
|
||||
case 1:
|
||||
*(p++) = '1';
|
||||
break;
|
||||
case 2:
|
||||
*(p++) = 'u';
|
||||
break;
|
||||
case 3:
|
||||
*(p++) = 'z';
|
||||
break;
|
||||
default:
|
||||
*(p++) = 'u';
|
||||
break;
|
||||
}
|
||||
|
||||
*(p) = 0;
|
||||
return(s);
|
||||
}
|
||||
Loading…
Reference in New Issue