Categorygithub.com/learn-systemverilog/learn-systemverilog-api

# README

Learn SystemVerilog API

Go Report Card DeepSource

Learn SystemVerilog API is the API used by learn-systemverilog-web. Currently, it transpiles the code written in SystemVerilog to JavaScript so that the simulation can work in any browser.

You can find this API running at https://learn-systemverilog-api.herokuapp.com.

Requirements

Setup

First of all, clone the repository:

git clone https://github.com/learn-systemverilog/learn-systemverilog-api.git

cd learn-systemverilog-api

Then, build the docker image:

docker build --tag learn-systemverilog-api .

Next, run the docker image as a container:

docker run --publish 8080:8080 learn-systemverilog-api

Later, open this url: http://localhost:8080. You should see the following message:

{"message":"Hello, World!"}

Congratulations!

Usage

To transpile a code written in SystemVerilog to JavaScript, you will need to watch (you can use your browser) for the Server-sent events on the following endpoint:

GET http://localhost:8080/transpile?code={YOUR_SYSTEMVERILOG_CODE}

There are four types of events:

NameFormatDescription
internal{"message": "...", "severity": "debug|info|warn|error"}Internal logs from the server
stdout{"stdout": "..."}Standard output written by the transpilers
stderr{"stderr": "..."}Standard error written by the transpilers
output"var Module = typeof Module !== 'undefined' ? Module : {};\n\n// --..."A JSON encoded string representing the transpiled JavaScript code. This means that the transpilation was successful

How it works

SystemVerilog -> [Verilator: C++] -> [Emscripten: JavaScript] -> JavaScript

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Some things we need:

  • Tests
  • Better workspace isolation and security
  • C++ to JavaScript transpilation time and output size improvement

License

MIT

# Packages

No description provided by the author
No description provided by the author