Crates.io | sv4state |
lib.rs | sv4state |
version | 0.2.0 |
source | src |
created_at | 2021-09-07 09:28:22.51239 |
updated_at | 2021-09-13 06:46:02.892412 |
description | SystemVerilog 4-state value library |
homepage | |
repository | https://github.com/dalance/sv4state |
max_upload_size | |
id | 447894 |
size | 23,539 |
sv4state is a Rust library for SystemVerilog 4-state value.
logic
value which is passed throgh SystemVerilog DPI can be handled by this library.
svLogicVecVal
shows a 32bit logic
value of SystemVerilog.
So logic [127:0]
corresponds to [svLogicVecVal; 4]
.
use sv4state::{svLogicVecVal, Sv4State};
#[no_mangle]
pub extern "C" fn get_data(data: &[svLogicVecVal; 4]) {
let sv_u32 = Sv4State::<u32>::from_dpi(data);
println!("{:x}", sv_u32[0]);
println!("{:x}", sv_u32[1]);
println!("{:x}", sv_u32[2]);
println!("{:x}", sv_u32[3]);
}
The get_data()
can be call through SystemVerilog DPI like below:
import "DPI-C" function void get_data(
input logic [127:0] data
);