1 |
12 |
dgisselq |
# A Wishbone Controlled Scope for FPGA's
|
2 |
|
|
|
3 |
|
|
This is a generic/library routine for providing a bus accessed 'scope' or
|
4 |
|
|
(perhaps more appropriately) a bus accessed logic analyzer for use internal to
|
5 |
|
|
an FPGA. The general operation is such that this 'scope' can record and report
|
6 |
14 |
dgisselq |
on any 32 bit value transiting through the FPGA that you have connected to the
|
7 |
|
|
scope. Once started and reset, the
|
8 |
12 |
dgisselq |
scope records a copy of the input data every time the clock ticks with the
|
9 |
|
|
circuit enabled. That is, it records these values up until the trigger. Once
|
10 |
|
|
the trigger goes high, the scope will record for ``bw_holdoff`` more counts
|
11 |
|
|
before stopping. Values may then be read from the buffer, oldest to most
|
12 |
|
|
recent. After reading, the scope may then be reset for another run.
|
13 |
|
|
|
14 |
|
|
In general, therefore, operation happens in this fashion:
|
15 |
|
|
|
16 |
|
|
1. A reset is issued.
|
17 |
|
|
2. Recording starts, in a circular buffer, and continues until
|
18 |
|
|
3. The trigger line is asserted.
|
19 |
|
|
The scope registers the asserted trigger by setting the ``o_triggered`` output flag.
|
20 |
14 |
dgisselq |
4. A counter then ticks until the last value is written.
|
21 |
12 |
dgisselq |
The scope registers that it has stopped recording by setting the ``o_stopped`` output flag.
|
22 |
|
|
5. The scope recording is then paused until the next reset.
|
23 |
|
|
6. While stopped, the CPU can read the data from the scope
|
24 |
|
|
|
25 |
|
|
- oldest to most recent
|
26 |
|
|
- one value per bus clock
|
27 |
14 |
dgisselq |
|
28 |
12 |
dgisselq |
7. Writes to the data register reset the address to the beginning of the buffer
|
29 |
|
|
|
30 |
14 |
dgisselq |
# Tutorials
|
31 |
|
|
|
32 |
|
|
The Wishbone scope was featured on [zipcpu.com](http://zipcpu.com) as [a
|
33 |
|
|
conclusion](http://zipcpu.com/blog/2017/07/08/getting-started-with-wbscope.html)
|
34 |
|
|
to the discussion of the example [debugging
|
35 |
|
|
bus](https://github.com/ZipCPU/dbgbus/tree/master/hexbus).
|
36 |
|
|
That example discussed how to hook up the scope to your logic, as well as how
|
37 |
|
|
to employ the [scope software](sw/scopecls.cpp) to create a VCD file
|
38 |
|
|
that could then be viewed in GTKWave.
|
39 |
|
|
The scope was also mentioned as a means of capturing [traces of button
|
40 |
|
|
bounces](http://zipcpu.com/blog/2017/08/02/debounce-teaser.html),
|
41 |
|
|
with the short discussion of how to set it up for that task
|
42 |
|
|
[here](http://zipcpu.com/blog/2017/08/07/bounce-dbgbus.html).
|
43 |
|
|
|
44 |
|
|
# Interfaces supported
|
45 |
|
|
|
46 |
|
|
1. [Wishbone B4/pipelined](rtl/wbscope.v)
|
47 |
|
|
2. [AXI lite](rtl/axi4lscope.v)
|
48 |
|
|
3. [Avalon](rtl/avscope.v)
|
49 |
|
|
|
50 |
12 |
dgisselq |
# Commercial Applications
|
51 |
|
|
|
52 |
|
|
Should you find the GPLv3 license insufficient for your needs, other licenses
|
53 |
14 |
dgisselq |
can be purchased from [Gisselquist Technology,
|
54 |
|
|
LLC](http://zipcpu.com/about/gisselquist-technology.html).
|