Code Monkey home page Code Monkey logo

virtual-board-vhdl's Introduction

⚠️ PROJECT UNDER DEVELOPMENT ⚠️

do not expect good documentation, clean and working code (for now)

Virtual Board for VHDL code simulation

Started in 2022, this project aims to allow VHDL simulation on a "virtual board" (so a FPGA board won't be required), in a more friendly way (so you won't need to look at waveforms again!).

(It's not an emulator since it does not emulate 100% real hardware)

Quick overview

VHDL Simulation

The VHDL simulation is done via GHDL, which runs a .vpi module built by g++. The module interacts with the VHDL simulation via libghdl shared library.

We can manipulate the simulation signals values via a websocket server, customize board IO pins and also assign signals to those pins, read more about the VPI module here.

UsbPort

One of the goals is also to add compatibility with UsbPort, which is a library that allows manipulating VHDL circuit signals via a Kotlin/Java application. This is done via a HTTP server running alongside the VPI.

Board UI (static)

Since it has a websocket server, it won't be hard to display signals in a "pretty" way to the user.

Here (fpga_static_ui_example) is a quick UI prototype built with HTML+CSS+JS to show what a board interface can look like.

Board UI (dynamic)

The good approach would be to create a UI that reads board.json and creates a UI with IO signals depending on what pins the config file has. The board should be also customizable via a config file. Under Development: https://github.com/roby2014/virtual-board-gui

Credits

  • GHDL - VHDL 2008/93/87 simulator
  • ghdl-cosim - GHDL co-simulation projects using VPI
  • seasocks - Simple, small, C++ embeddable webserver with WebSockets support
  • nlohmann/json - JSON for Modern C++
  • cpp-httplib - A C++ header-only HTTP/HTTPS server and client library
  • khttp - Kotlin HTTP requests library

virtual-board-vhdl's People

Contributors

roby2014 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hugopeixoto

virtual-board-vhdl's Issues

USBPort integration

Since this is mostly for academic purposes, there is a tool named USBPort which allows communication between Kotlin/Java modules with hardware board ports.

Since we want to "emulate" the board here, it should have some sort of implementation to allow communication between USBPort and the emulator/simulator.

I think websockets will be enough for this, but I should gather more info about USBPort first.

Separate object files to another directory instead of `src/`

At the moment the make command creates an object file for each .cpp file, but in it's directory (src/)
Imo a better approach would be to move/create them in build/, since moving around in the IDE is a bit confusing with so many .o files.

Implement `GET/PUT signal_name[optional_idx]` commands

Assuming we have this configuration:

PIN_A8 -> enable[0]
PIN_A9 -> enable[1]

At the moment, the websocket server can respond to commands like GET PIN_ID, e.g GET PIN_A8.

It would be very useful to do commands like GET enable where it would return the whole signal value, or GET enable[0], returning bit 0 of enable signal.
The same applies to PUT..

Implement HTTP server for UsbPort, and WebSocket for normal PORT

The current implementation looks some thing like this:
goal drawio

  • Websocket has commands for manipulating either normal PORT and UsbPort

Since UsbPort only reads/writes, we could make this a bit more efficient by making HTTP routes and communicate with the simulation via HTTP, while the websocket will broadcast to its clients if any PIN from PORT changed, this way we can implement a listener when creating the UI interface.

So in the end it will look something like this:

final_goal drawio

why not all in one HTTP server?

Well since the simulation is always running, our board interface needs to be 100% in sync with the simulation signals, and by doing HTTP requests every frame, it could cause an overhead or poor performance, so I think having the interface as a listener to the websocket server is a better approach.

Generate `UsbPort_VPI_GHDL` project script (GUI tool?)

Currently we have a python script that can transform an UsbPort via JTAG implementation into one that uses the GHDL+VPI approach.

The problem is, this script should also replace the VHDL files inside the Makefile, so when we compile our VPI and simulate via GHDL, it uses the new generated files.

My suggestion would be to have some sort of GUI tool for all of this, e.g:

  • Add VHDL files to project
  • Run script button to generate new UsbPort and top entity (or clone project without usbport and top entity?)
  • Compile VPI button
  • Run VPI button

So the user does not have to do all by hand...

Customizable board interface

Would be nice to have a somehow clean implementation of a board gui interface showing all board pins, signals, buttons, etc... It should be 100% customizable, so the user can configure as it wants.

Since the emulator/simulator has a websocket server implementation, this opens doors to many options, so the interface can be built really in any language/library.

Some interesting libraries:

  • imgui
  • tornadoFX

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.