Skip to content

Latest commit

 

History

History
101 lines (70 loc) · 4.98 KB

readme_en.md

File metadata and controls

101 lines (70 loc) · 4.98 KB

sv-JTracing(Online)

| 中文 | English |

GitHubStars GitHub pull-requests GitHub LICENSE GitHub contributors

Using C++ to implement a high performance online compiler system for SystemVerilog, the SystemVerilog source code can be highly robust lexical analysis, common Syntax analysis and partial semantic analysis, generating reliable Abstract Syntax Tree. It also provides Parser process information, error information and variable table. The online compilation system can achieve nearly ten thousand QPS through webbenchh stress test.

function

  • Using character by character scanning SystemVerilog source code for highly robust lexical analysis, stable generation of corresponding tokens;
  • Use recursive descent method to manually build the parser, realize SystemVerilog common syntax check, generate analysis results and output reliable abstract syntax tree;
  • A high concurrency model of multithreaded Reactor using IO multiplexing technology Epoll and thread pool;
  • Use the state machine to parse HTTP request messages and escape url character encoding to realize the analysis and processing of static resource requests;

Demo


  • Online compilation system overall video demonstration
  • example1-module
module m;
    // hello
    bit [4:0] b;
    int b; //Note: There is a rename error
    begin end
endmodule

image

  • example2-for
int a = 0;
for (int i = 0; i <= 5; i++) begin
        a = a + 1;
end

image

*Example 2 shows the overall AST abstract syntax tree structure of SystemVerilog code: image

*The AST abstract syntax tree in the for loop is fully displayed: image

Environmental requirements

  • Linux environment
  • C++17
  • The default port for running the server program is 4466. Check whether this port is occupied before running

Version iteration

__HTTP request parsing __ : The original version of http request parsing was clunky, parsing the meaning of a fixed range of bits by a character-by-character scan

----> Update: parses HTTP request messages using regular operations and finite state machines

__SystemVerilog code compilation results are returned to __ : After identifying the "compile button", the original version will modify the content-type of the response message to text/plain, and then add a string generated by the compilation result to the response body and send it back to the browser

---->_ update _ : The compiler of SystemVerilog code is written into the.txt text in the resource directory. Then the browser requests the.txt resource and obtains its text content. Since it is written to the same file and then cleared, the file is the critical resource. The server program in the business processing using multithreading mode to the critical resource to cause read and write errors, then use a mutex to ensure the atomicity

---->_ update _ : Because the server program in the high concurrency state of mutex will significantly inhibit the efficiency of the overall program, so the method of randomly generating and writing each thread file, after the thread execution will delete the file, the core idea is to use space for time to improve the efficiency of the program. (But now the problem is how does the thread create a.txt file to let the browser know which.txt file resource to request?)

Project start-up

make
./bin/server

Webbench Test result

Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://192.168.48.128:1316/
7000 clients, running 5 sec.

Speed=132156 pages/min, 6923630 bytes/sec.
Requests: 11013 susceed, 0 failed.

Acknowledgement

@Ruslan Spivak: Let's Build A Simple Interpreter

@LLVM: My First Language Frontend with LLVM Tutorial

《Linux高性能服务器编程》,游双著.

@qinguoyi:TinyWebServer Open source project

@MikePopoloski:slang Open source project