learn-systemverilog-api

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 4 Imported by: 0

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:

Name Format Description
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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL