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
43 #define AVR_VCD_LOG_SIZE 5120
45 typedef struct avr_vcd_signal_t {
46 avr_irq_t irq; // receiving IRQ
47 char alias; // vcd one character alias
49 char name[32]; // full human name
52 typedef struct avr_vcd_log_t {
54 avr_vcd_signal_t * signal;
58 typedef struct avr_vcd_t {
59 struct avr_t * avr; // AVR we are attaching timers to..
61 char filename[74]; // output filename
65 avr_vcd_signal_t signal [AVR_VCD_MAX_SIGNALS];
71 avr_vcd_log_t log[AVR_VCD_LOG_SIZE];
74 // initializes a new VCD trace file, and returns zero if all is well
75 int avr_vcd_init(struct avr_t * avr,
76 const char * filename, // filename to write
77 avr_vcd_t * vcd, // vcd struct to initialize
78 uint32_t period ); // file flushing period is in usec
79 void avr_vcd_close(avr_vcd_t * vcd);
81 // Add a trace signal to the vcd file. Must be called before avr_vcd_start()
82 int avr_vcd_add_signal(avr_vcd_t * vcd,
83 avr_irq_t * signal_irq,
87 // Starts recording the signal value into the file
88 int avr_vcd_start(avr_vcd_t * vcd);
89 // stops recording signal values into the file
90 int avr_vcd_stop(avr_vcd_t * vcd);
96 #endif /* __SIM_VCD_FILE_H__ */