4 Implements a Value Change Dump file outout to generate
5 traces & curves and display them in gtkwave.
7 Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
9 This file is part of simavr.
11 simavr is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 simavr is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with simavr. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef __SIM_VCD_FILE_H__
26 #define __SIM_VCD_FILE_H__
36 * Value Change dump module for simavr.
38 * This structure registers IRQ change hooks to various "source" IRQs
39 * and dumps their values (if changed) at certain intervals into the VCD file
42 #define AVR_VCD_MAX_SIGNALS 32
44 typedef struct avr_vcd_signal_t {
45 avr_irq_t irq; // receiving IRQ
46 char alias; // vcd one character alias
48 char name[32]; // full human name
51 typedef struct avr_vcd_log_t {
53 avr_vcd_signal_t * signal;
55 } avr_vcd_log_t, *avr_vcd_log_p;
57 #define AVR_VCD_LOG_CHUNK_SIZE (4096 / sizeof(avr_vcd_signal_t))
59 typedef struct avr_vcd_t {
60 struct avr_t * avr; // AVR we are attaching timers to..
62 char filename[74]; // output filename
66 avr_vcd_signal_t signal [AVR_VCD_MAX_SIGNALS];
76 // initializes a new VCD trace file, and returns zero if all is well
77 int avr_vcd_init(struct avr_t * avr,
78 const char * filename, // filename to write
79 avr_vcd_t * vcd, // vcd struct to initialize
80 uint32_t period ); // file flushing period is in usec
81 void avr_vcd_close(avr_vcd_t * vcd);
83 // Add a trace signal to the vcd file. Must be called before avr_vcd_start()
84 int avr_vcd_add_signal(avr_vcd_t * vcd,
85 avr_irq_t * signal_irq,
89 // Starts recording the signal value into the file
90 int avr_vcd_start(avr_vcd_t * vcd);
91 // stops recording signal values into the file
92 int avr_vcd_stop(avr_vcd_t * vcd);
98 #endif /* __SIM_VCD_FILE_H__ */