{"id":24756363,"url":"https://github.com/dalance/rust-dpi-sample","last_synced_at":"2025-03-23T07:17:20.248Z","repository":{"id":146818456,"uuid":"237206255","full_name":"dalance/rust-dpi-sample","owner":"dalance","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-13T09:33:03.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T13:54:39.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"SystemVerilog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-30T12:15:07.000Z","updated_at":"2022-07-28T02:38:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"74111b8d-b404-44be-a4e1-5d53df8efb01","html_url":"https://github.com/dalance/rust-dpi-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Frust-dpi-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Frust-dpi-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Frust-dpi-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Frust-dpi-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalance","download_url":"https://codeload.github.com/dalance/rust-dpi-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245066713,"owners_count":20555431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-28T13:51:06.323Z","updated_at":"2025-03-23T07:17:20.240Z","avatar_url":"https://github.com/dalance.png","language":"SystemVerilog","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-dpi-sample\n\nThis is an example project using Rust from System Verilog DPI.\nYou can try like below:\n\n```console\n$ make\n\n...\n\n[src/lib.rs:49] a = \"Hello World\"\nObject { x: 10000, y: \"Hello\" } is destroied\n00000001 + 00000002 = 03\n00000001 + 00000002 = 0003\n00000001 + 00000002 = 00000003\n00000001 + 00000002 = 0000000000000003\n00000001 + 00000002 = 0000000000000003\n00000011 ^ 00000022 = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033\n- test.sv:43: Verilog $finish\n```\n\nThe default target of `Makefile` uses [Verilator](https://www.veripool.org/wiki/verilator) as System Verilog simulator.\nIf you can use Synopsys VCS, `make vcs` can be used.\n\n\n# Source code example\n\n## Rust side\n\n`#[no_mangle]` and `extern \"C\"` is required.\n\n```rust\n#[no_mangle]\npub extern \"C\" fn add_i8(x: i8, y: i8) -\u003e i8 {\n    x + y\n}\n```\n\n## System Verilog side\n\n```systemverilog\nimport \"DPI-C\" function byte add_i8 (input byte x, input byte y);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Frust-dpi-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalance%2Frust-dpi-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Frust-dpi-sample/lists"}