File: vcd.html

package info (click to toggle)
sdcc 4.5.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 112,980 kB
  • sloc: ansic: 622,683; cpp: 259,454; makefile: 81,253; sh: 40,203; asm: 19,222; perl: 12,139; yacc: 7,761; awk: 3,378; lisp: 1,677; python: 1,097; lex: 1,028; sed: 76
file content (194 lines) | stat: -rw-r--r-- 6,711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
    <title>&micro;Csim: VCD file dumper</title>
  </head>
  <body style="background-color: white;">
    <h1>VCD file I/O</h1>

      <p>Initially there is one vcd defined called "vcd[0]" (or just "vcd").
      You can create an additional vcds with "set hw vcd[0] new <i>id</i>" and
      configure it with "set hw vcd[<i>id</i>] ..." commands ("<i>id</i>" must
      be an integer).</p>

    <h2>Output (event logging)</h2>

      <p>The vcd module creates VCD files compatible with industry standards and
      readable with open source tools such as gtkwave and sigrok/pulseview.</p>
      <p>(N.B. sigrok/pulseview only supports VCD files containing events that
      are 1 bit wide only.)</p>

      <ol>
        <li>Specify output file<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] output "name.vcd"</font>
          </pre>
          <p>Alternatively specify no, or an empty, output file or use the
          "view" command and the simulator will attempt to invoke
          <a href="http://gtkwave.sourceforge.net/">gtkwave</a>
          directly.</p>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] output ""</font>
          0&gt; <font color="#118811">set hw vcd[0] view</font>
          </pre>
        </li>

        <li>Add locations to dump<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] add pc_odr</font>
          0&gt; <font color="#118811">set hw vcd[0] add rom[0x500a].3</font>
          </pre>
          You can set the name of the module if you want (set hw vcd[0] module
          name), it will be ucsim_vcd_0 by default.<br>
          <br>
        </li>

        <li>Check the configuration<br>
          <pre>
          0&gt; <font color="#118811">info hw vcd[0]</font>
          vcd[0] value change dump
            Module:      ucsim_vcd_0
            Started:    no
            Paused:     no
            File:       name.vcd
            Mode:       output
            Time scale: auto set on start
            Start time: 0.000000000000000 s
            Last event: 0.000000000000000 s
            Simul time: 0.000000000000000 s
            Variables:
              Address           Symbol
              rom[0x0500a][7:0] pc_odr
              rom[0x0500a].3
          </pre>
        </li>

        <li>Start recording<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] start</font>
          </pre>
        </li>

        <li>Run the program<br>
          <br>
        </li>

        <li>You can pause/resume recording<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] pause</font>
          0&gt; <font color="#118811">set hw vcd[0] restart</font>
          </pre>
          <p>While the vcd is paused no changes are recorded in the
          output and values will show as unknown when the VCD is viewed
          by something such as
	  <a href="http://gtkwave.sourceforge.net/">gtkwave</a>.</p>
	  <p>If you set pausetime then the time recorded as unknown
	  will be limited to the specified time and time beyond that
	  will simply not exist as far as the VCD is concerned.
	  This may be used to compress pause gaps in the VCD for the
	  sake of viewers which are not able to do this themselves.</p>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] pausetime 300 ns</font>
          </pre>
        </li>

        <li>Stop recording and close the VCD file<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] stop</font>
          </pre>
        </li>
      </ol>

    <h2>Input (event replay)</h2>

      <ol>
        <li>Define any variables used by the input file<br>
          <pre>
          0&gt; <font color="#118811">var loc1 rom[0x5001]</font>
          </pre>
        </li>

        <li>Specify input file<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] input "name.vcd"</font>
          </pre>
        </li>

        <li>Adjust the base time<br>
          By default time 0 in the VCD file corresponds to the simulator time
          when the vcd is started. You can adjust this by setting the start time
          of the vcd. For instance, to move the VCD events 750 ns into the future
          you would use
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] starttime 750 ns</font>
          </pre>
          <p>This can be done at any time, regardless of whether the vcd is started,
          paused or even part way through.</p>
          <p>Note that the argument to starttime is the amount to add or subtract
          from the current start time not an absolute time.</p>
          <br>
        </li>

        <li>Start the replay<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] start</font>
          <pre>
        </li>

        <li>Check the configuration<br>
          N.B. The VCD file's header is only parsed when the vcd is started.
          Until then the configuration details are unknown.<br>
          <pre>
          0&gt; <font color="#118811">info hw vcd[0]</font>
          vcd[0] value change dump
            Module:      ucsim_vcd_0
            Started:    YES
            Paused:     no
            File:       name.vcd
            Mode:       input
            Break:      disabled
            Time scale: 1 ns
            Start time: 0.000000000000000 s
            Next event: 0.000000000000000 s
            Simul time: 0.000000000000000 s
            Variables:
              Address           Symbol
              rom[0x0500a]      pc_odr
              rom[0x0500a].3
          </pre>
        </li>

        <li>Run the program<br>
          <br>
        </li>

        <li>Pause/resume replay<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] pause</font>
          0&gt; <font color="#118811">set hw vcd[0] restart</font>
          </pre>
          <p>While the replay is paused any cycles used by the simulator
          are ignored by vcd and do NOT advance you towards the next
          event.</p>
          <br>
        </li>

        <li>Toggle the break flag as required<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] break</font>
          </pre>
          <p>The break flag causes vcd to generate a break each an event
          is replayed giving you the opportunity to check that your program
          responds to it correctly.</p>
          <br>
        </li>

        <li>Stop the replay and close the VCD file<br>
          <pre>
          0&gt; <font color="#118811">set hw vcd[0] stop</font>
          </pre>
        </li>
      </ol>

  </body>
</html>