Coder Social home page Coder Social logo

wd5gnr / verifla Goto Github PK

View Code? Open in Web Editor NEW
31.0 5.0 5.0 1.04 MB

Fork of OpenVeriFla - FPGA debugging logic analyzer to use with your designs - examples (so far) for ice40/IceStorm

C 11.40% Java 32.61% Batchfile 0.11% Shell 0.16% Verilog 55.73%
ice40 max10 fpga verilog max1000 lattice icestorm icestick

verifla's Introduction

Verifla

This is a fork of OpenVerifla (https://opencores.org/project/openverifla) that tries to do a few things:

  1. Document some of the settings a bit better
  2. Fix a bug where samples that changed on one clock were not handled properly
  3. Add synchronous memory that is easier for some tools to infer
  4. Some minor cleanups and plans for enhancements
  5. C tool to read output and generate VCD directly (see C directory for build instructions)
  6. Adds clock enable/qualifier (defaults to 1 so you don't need to specify it if you don't use it)
  7. Adds armed and trigger outputs
  8. Adds trigger qualifier (must be 1 -- set by default -- for internal trigger to work)
  9. Adds exttrig (default 0) if you want your own trigger logic -- does not respect trigger qualifier as we assume you could do that yourself if you wanted to

Note on 6, 7, 8, and 9: The armed output goes high when the monitor state machine is running. The triggered output goes high when something triggers the state machine. The data sample clock only reads a sample when the cqual, the clock qualifier, is 1 (the default). So if you know your circuit only does interesting things when counter==0 for example you can set that as the clock qualifier. You can drive exttrig to 1 if you want to trigger with your own complex logic. For example, you could have a state machine read serial data and trigger when you see a certain serial character. For the internal trigger, you can inhibit it by setting trigqual to 0 (the default is 1). For example, you might only drive it high after some precondition to prevent an early trigger.

The PDF attached has some good information on it. However, a few things to note:

  1. Do not set Run to 1 in your code unless your trigger is infrequent. If data constantly spews out of the FPGA, the JAVA code can not sync to it.

  2. There are some strange unsquashed bugs. For example, on the Lattice iCe40 with Icestorm tools (at least) setting memory to 256 bytes and the trigger position to 128 causes a hang. Trigger positions at 127 and 129 are fine.

Possible Enhancements

  1. Uart clock vs Sample clock (Uart clock >> Sample clock)
  2. Clock Enable for sample clock (done)
  3. Change post trigger samples to do post trigger memory words (or document to set huge #)
  4. Java: Pick up Verilog file from template

Quick Start

  1. Link or copy the verifla directory (the one under verilog) to your project directory
  2. Copy config_verifla.v.template to your working directory and rename it to config_verifla.v
  3. Make sure your Verilog tool will look in the verifla directory as a library
  4. Make sure the search path for includes will look in your project directory first
  5. Edit config_verifla.v in your project directory to se clock speed, baud rate, memory size, etc.
  6. Write your verilog in the project directory.
  7. Create a top_of_verifla module. Here are the signals:
  • clk - Clock
  • cqual - Qualifier for data capture clock (UART and other things use clk alone). If you don't want a qualifier, just set to 1'b1 (which is the default).
  • rst_l - Active low reset.
  • sys_run - High to arm logic analyzer. If you only want to arm from the PC, set to 1'b0.
  • data_in - Your inputs. Group together like {led3, led2, led1, led0, count[3:0]}.
  • uart_XMIT_dataH - Your RS232 transmit line
  • uart_REC_dataH - Your RS232 receive line
  • armed - digital output showing LA is armed
  • triggered - digital output showing LA is triggered
  • trigqual - Must be set to 1 to allow internal trigger to occur (default is 1)
  • exttrig - Set to 1 to force a trigger (default is 0; does not respect trigqual)
  1. Once running you can use the original Java program to create a .v file you will need to simulate or the C program (la2vcd) to create a .vcd you can read using a waveform viewer (like GTKWave)

Notes about using GTKWave

The C program creates a simple dump that has the entire capture data and also each byte captured. You can suppress the bytes (-W) or the aggregate (-B) if you like. However, you really want to have the signals broken back out like they are in your code.

Suppose you have 16-bits of data like this: counter8[7:0], led0, state[6:0]

It is easy to add the capdata[15:0] data to GTKWave. Then expand it into bits. Select the counter8 bits and press Combine Down on the Edit menu (or Combine Up if you are reversed endian). This will prompt you for a name so enter "counter8" and press OK. Now you'll have a counter 8 signal. Repeat for state. For the led0 signal, you can create an alias.

Of course, this is painful to set up every time so use Write Save File on the File menu. This will save the layout for next time you load a VCD with the same format.

Note about Quartus and possibly other synthesis tools

Quartus requires that you enable System Verilog for the config file parameters to work.

Many synthesizers will accept module definitions like this: module foo(input bar=1'b1);

Quartus appears to not accept these even in System Verilog mode. To work around this you can use top_of_verifla_nodef instead of top_of_verifla_nodef. In this case, you need to provide inputs (even if constants) for sys_run, cqual, trigqual, and exttrig.

The code has been lightly tested on a MAX10 FPGA and there is an example in the demos folder.

verifla's People

Contributors

wd5gnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.