Skip to content

Commit

Permalink
add compiler support for asm and systemverilog
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsgsDesign committed Mar 29, 2022
1 parent f8db0df commit 91b7d84
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 48 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ NOJ now supports 19 popular programming languages, you can start issues about ne
|Free Pascal|/usr/bin/fpc -O2 -o{exe_path} {src_path}|
|Plaintext|/bin/cat {exe_path}|
|Free Basic|/usr/local/bin/fbc {src_path}|
|Assembly (32bit)|/usr/bin/nasm -f elf32 -o {exe_path}.o {src_path} && /usr/bin/gcc -m32 -o {exe_path} {exe_path}.o|
|Assembly (64bit)|/usr/bin/nasm -f elf64 -o {exe_path}.o {src_path} && /usr/bin/gcc -o {exe_path} {exe_path}.o|
|SystemVerilog 2012|/usr/bin/iverilog -g2012 -o {exe_path} {src_path}<br>/usr/bin/vvp {exe_path}|

### Supported Feature

Expand Down
51 changes: 51 additions & 0 deletions app/Babel/Extension/noj/Languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,57 @@ public static function get()
],
'factors' => $default_factors
],
'systemverilog_lang_config' => [
'compile' => [
'src_name' => 'Main.sv',
'exe_name' => 'Main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/iverilog -g2012 -o {exe_path} {src_path}',
],
'run' => [
'command' => '/usr/bin/vvp {exe_path}',
'seccomp_rule' => 'general',
'env' => $default_env,
'memory_limit_check_only' => 1
],
'factors' => $default_factors
],
'asm32_lang_config' => [
'compile' => [
'src_name' => 'Main.asm',
'exe_name' => 'Main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/nojasm-compiler 32 {exe_path} {src_path}',
],
'run' => [
'command' => '{exe_path}',
'seccomp_rule' => null,
'env' => $default_env,
'memory_limit_check_only' => 1
],
'factors' => $default_factors
],
'asm64_lang_config' => [
'compile' => [
'src_name' => 'Main.asm',
'exe_name' => 'Main',
'max_cpu_time' => 3000,
'max_real_time' => 10000,
'max_memory' => 1024 * 1024 * 1024,
'compile_command' => '/usr/bin/nojasm-compiler 64 {exe_path} {src_path}',
],
'run' => [
'command' => '{exe_path}',
'seccomp_rule' => null,
'env' => $default_env,
'memory_limit_check_only' => 1
],
'factors' => $default_factors
],
];
}
}
24 changes: 24 additions & 0 deletions app/Babel/Extension/noj/compiler/1647596099.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"modifications":[{
"code": "systemverilog",
"compability": "systemverilog",
"language": "systemverilog",
"icon": "langicon-verilog",
"display": "SystemVerilog 2012",
"method": "add"
}, {
"code": "asm32",
"compability": "asm",
"language": "asm",
"icon": "langicon-assembly",
"display": "ASM (nasm 32bit)",
"method": "add"
}, {
"code": "asm64",
"compability": "asm",
"language": "asm",
"icon": "langicon-assembly",
"display": "ASM (nasm 64bit)",
"method": "add"
}]
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"njuptaaa/noj-large-file-upload": "^1.0",
"njuptaaa/poem": "^1.0.3",
"njuptaaa/laravel-admin-assets": "^1.8.16",
"noj-language-service/configurations": "^1.0.0",
"noj-language-service/grammars": "^1.0.0",
"noj-language-service/themes": "^1.0.0",
"noj-language-service/configurations": "^1.2.0",
"noj-language-service/grammars": "^1.2.0",
"noj-language-service/themes": "^1.0.1",
"npm-asset/mathjax": "^2.7",
"npm-asset/vscode-oniguruma": "1.3.0",
"orangehill/iseed": "^2.6",
Expand Down
91 changes: 46 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 91b7d84

Please sign in to comment.