diff --git a/t1rocketemu/online_dpi/Cargo.toml b/t1rocketemu/online_dpi/Cargo.toml deleted file mode 100644 index 5d2cb5f5d..000000000 --- a/t1rocketemu/online_dpi/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "online_dpi" -edition = "2021" -version.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -common = { path = "../test_common" } -spike_rs = { path = "../spike_rs" } -clap = { workspace = true } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } -anyhow = { workspace = true } - -elf = "0.7.4" -hex = "0.4.3" - -[features] -sv2023 = [] -svvpi = [] -trace = [] diff --git a/t1rocketemu/online_dpi/src/dpi.rs b/t1rocketemu/online_dpi/src/dpi.rs deleted file mode 100644 index 2d7f88a5f..000000000 --- a/t1rocketemu/online_dpi/src/dpi.rs +++ /dev/null @@ -1,338 +0,0 @@ -#![allow(non_snake_case)] -#![allow(unused_variables)] - -use clap::Parser; -use std::ffi::{c_char, c_longlong, CString}; -use std::sync::Mutex; -use tracing::debug; - -use crate::drive::Driver; -use crate::svdpi::SvScope; -use crate::OfflineArgs; - -pub type SvBitVecVal = u32; - -// -------------------------- -// preparing data structures -// -------------------------- - -static DPI_TARGET: Mutex>> = Mutex::new(None); - -pub(crate) struct AxiReadPayload { - pub(crate) data: Vec, -} - -unsafe fn write_to_pointer(dst: *mut u8, data: &[u8]) { - let dst = std::slice::from_raw_parts_mut(dst, data.len()); - dst.copy_from_slice(data); -} - -unsafe fn fill_axi_read_payload(dst: *mut SvBitVecVal, dlen: u32, payload: &AxiReadPayload) { - let data_len = 256 * (dlen / 8) as usize; - assert!(payload.data.len() <= data_len); - write_to_pointer(dst as *mut u8, &payload.data); -} - -// Return (strobe in bit, data in byte) -unsafe fn load_from_payload( - payload: &*const SvBitVecVal, - data_width: usize, - size: usize, -) -> (Vec, &[u8]) { - let src = *payload as *mut u8; - let data_width_in_byte = std::cmp::max(size, 4); - let strb_width_per_byte = if data_width < 64 { 4 } else { 8 }; - let strb_width_in_byte = size.div_ceil(strb_width_per_byte); - - let payload_size_in_byte = strb_width_in_byte + data_width_in_byte; // data width in byte - let byte_vec = std::slice::from_raw_parts(src, payload_size_in_byte); - let strobe = &byte_vec[0..strb_width_in_byte]; - let data = &byte_vec[strb_width_in_byte..]; - - let masks: Vec = strobe - .into_iter() - .flat_map(|strb| { - let mask: Vec = (0..strb_width_per_byte).map(|i| (strb & (1 << i)) != 0).collect(); - mask - }) - .collect(); - assert_eq!( - masks.len(), - data.len(), - "strobe bit width is not aligned with data byte width" - ); - - debug!( - "load {payload_size_in_byte} byte from payload: raw_data={} strb={} data={}", - hex::encode(byte_vec), - hex::encode(strobe), - hex::encode(data), - ); - - (masks, data) -} - -//---------------------- -// dpi functions -//---------------------- - -/// evaluate after AW and W is finished at corresponding channel_id. -#[no_mangle] -unsafe extern "C" fn axi_write_highBandwidthAXI( - channel_id: c_longlong, - awid: c_longlong, - awaddr: c_longlong, - awlen: c_longlong, - awsize: c_longlong, - awburst: c_longlong, - awlock: c_longlong, - awcache: c_longlong, - awprot: c_longlong, - awqos: c_longlong, - awregion: c_longlong, - // struct packed {bit [255:0][DLEN:0] data; - // bit [255:0][DLEN/8:0] strb; } payload - payload: *const SvBitVecVal, -) { - debug!( - "axi_write_highBandwidth (channel_id={channel_id}, awid={awid}, awaddr={awaddr:#x}, \ - awlen={awlen}, awsize={awsize}, awburst={awburst}, awlock={awlock}, awcache={awcache}, \ - awprot={awprot}, awqos={awqos}, awregion={awregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let (strobe, data) = load_from_payload(&payload, driver.dlen as usize, (1 << awsize) as usize); - driver.axi_write_high_bandwidth(awaddr as u32, awsize as u64, &strobe, data); -} - -/// evaluate at AR fire at corresponding channel_id. -#[no_mangle] -unsafe extern "C" fn axi_read_highBandwidthAXI( - channel_id: c_longlong, - arid: c_longlong, - araddr: c_longlong, - arlen: c_longlong, - arsize: c_longlong, - arburst: c_longlong, - arlock: c_longlong, - arcache: c_longlong, - arprot: c_longlong, - arqos: c_longlong, - arregion: c_longlong, - // struct packed {bit [255:0][DLEN:0] data; byte beats; } payload - payload: *mut SvBitVecVal, -) { - debug!( - "axi_read_highBandwidth (channel_id={channel_id}, arid={arid}, araddr={araddr:#x}, \ - arlen={arlen}, arsize={arsize}, arburst={arburst}, arlock={arlock}, arcache={arcache}, \ - arprot={arprot}, arqos={arqos}, arregion={arregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let response = driver.axi_read_high_bandwidth(araddr as u32, arsize as u64); - fill_axi_read_payload(payload, driver.dlen, &response); -} - -/// evaluate after AW and W is finished at corresponding channel_id. -#[no_mangle] -unsafe extern "C" fn axi_write_highOutstandingAXI( - channel_id: c_longlong, - awid: c_longlong, - awaddr: c_longlong, - awlen: c_longlong, - awsize: c_longlong, - awburst: c_longlong, - awlock: c_longlong, - awcache: c_longlong, - awprot: c_longlong, - awqos: c_longlong, - awregion: c_longlong, - // struct packed {bit [255:0][31:0] data; bit [255:0][3:0] strb; } payload - payload: *const SvBitVecVal, -) { - debug!( - "axi_write_high_outstanding (channel_id={channel_id}, awid={awid}, awaddr={awaddr:#x}, \ - awlen={awlen}, awsize={awsize}, awburst={awburst}, awlock={awlock}, awcache={awcache}, \ - awprot={awprot}, awqos={awqos}, awregion={awregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let (strobe, data) = load_from_payload(&payload, 32, (1 << awsize) as usize); - driver.axi_write_high_outstanding(awaddr as u32, awsize as u64, &strobe, data); -} - -/// evaluate at AR fire at corresponding channel_id. -#[no_mangle] -unsafe extern "C" fn axi_read_highOutstandingAXI( - channel_id: c_longlong, - arid: c_longlong, - araddr: c_longlong, - arlen: c_longlong, - arsize: c_longlong, - arburst: c_longlong, - arlock: c_longlong, - arcache: c_longlong, - arprot: c_longlong, - arqos: c_longlong, - arregion: c_longlong, - // struct packed {bit [255:0][DLEN:0] data; byte beats; } payload - payload: *mut SvBitVecVal, -) { - debug!( - "axi_read_high_outstanding (channel_id={channel_id}, arid={arid}, araddr={araddr:#x}, \ - arlen={arlen}, arsize={arsize}, arburst={arburst}, arlock={arlock}, arcache={arcache}, \ - arprot={arprot}, arqos={arqos}, arregion={arregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let response = driver.axi_read_high_outstanding(araddr as u32, arsize as u64); - fill_axi_read_payload(payload, driver.dlen, &response); -} - -#[no_mangle] -unsafe extern "C" fn axi_write_loadStoreAXI( - channel_id: c_longlong, - awid: c_longlong, - awaddr: c_longlong, - awlen: c_longlong, - awsize: c_longlong, - awburst: c_longlong, - awlock: c_longlong, - awcache: c_longlong, - awprot: c_longlong, - awqos: c_longlong, - awregion: c_longlong, - payload: *const SvBitVecVal, -) { - debug!( - "axi_write_loadStore (channel_id={channel_id}, awid={awid}, awaddr={awaddr:#x}, \ - awlen={awlen}, awsize={awsize}, awburst={awburst}, awlock={awlock}, awcache={awcache}, \ - awprot={awprot}, awqos={awqos}, awregion={awregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let data_width = if awsize <= 2 { 32 } else { 8 * (1 << awsize) } as usize; - let (strobe, data) = load_from_payload(&payload, data_width, (driver.dlen / 8) as usize); - driver.axi_write_load_store(awaddr as u32, awsize as u64, &strobe, data); -} - -#[no_mangle] -unsafe extern "C" fn axi_read_loadStoreAXI( - channel_id: c_longlong, - arid: c_longlong, - araddr: c_longlong, - arlen: c_longlong, - arsize: c_longlong, - arburst: c_longlong, - arlock: c_longlong, - arcache: c_longlong, - arprot: c_longlong, - arqos: c_longlong, - arregion: c_longlong, - payload: *mut SvBitVecVal, -) { - debug!( - "axi_read_loadStoreAXI (channel_id={channel_id}, arid={arid}, araddr={araddr:#x}, \ - arlen={arlen}, arsize={arsize}, arburst={arburst}, arlock={arlock}, arcache={arcache}, \ - arprot={arprot}, arqos={arqos}, arregion={arregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let response = driver.axi_read_load_store(araddr as u32, arsize as u64); - fill_axi_read_payload(payload, driver.dlen, &response); -} - -#[no_mangle] -unsafe extern "C" fn axi_read_instructionFetchAXI( - channel_id: c_longlong, - arid: c_longlong, - araddr: c_longlong, - arlen: c_longlong, - arsize: c_longlong, - arburst: c_longlong, - arlock: c_longlong, - arcache: c_longlong, - arprot: c_longlong, - arqos: c_longlong, - arregion: c_longlong, - payload: *mut SvBitVecVal, -) { - debug!( - "axi_read_instructionFetchAXI (channel_id={channel_id}, arid={arid}, araddr={araddr:#x}, \ - arlen={arlen}, arsize={arsize}, arburst={arburst}, arlock={arlock}, arcache={arcache}, \ - arprot={arprot}, arqos={arqos}, arregion={arregion})" - ); - let mut driver = DPI_TARGET.lock().unwrap(); - let driver = driver.as_mut().unwrap(); - let response = driver.axi_read_instruction_fetch(araddr as u32, arsize as u64); - fill_axi_read_payload(payload, driver.dlen, &response); -} - -#[no_mangle] -unsafe extern "C" fn t1rocket_cosim_init() { - let args = OfflineArgs::parse(); - args.common_args.setup_logger().unwrap(); - - let scope = SvScope::get_current().expect("failed to get scope in t1rocket_cosim_init"); - - let driver = Box::new(Driver::new(scope, &args)); - let mut dpi_target = DPI_TARGET.lock().unwrap(); - assert!( - dpi_target.is_none(), - "t1rocket_cosim_init should be called only once" - ); - *dpi_target = Some(driver); -} - -/// evaluate at every 1024 cycles, return reason = 0 to continue simulation, -/// other value is used as error code. -#[no_mangle] -unsafe extern "C" fn cosim_watchdog(reason: *mut c_char) { - // watchdog dpi call would be called before initialization, guard on null target - let mut driver = DPI_TARGET.lock().unwrap(); - if let Some(driver) = driver.as_mut() { - *reason = driver.watchdog() as c_char - } -} - -/// evaluate at every cycle, return quit_flag = false to continue simulation, -#[no_mangle] -unsafe extern "C" fn cosim_quit(quit_flag: *mut bool) { - // watchdog dpi call would be called before initialization, guard on null target - let mut driver = DPI_TARGET.lock().unwrap(); - if let Some(driver) = driver.as_mut() { - *quit_flag = driver.quit as bool - } -} - -#[no_mangle] -unsafe extern "C" fn get_resetvector(resetvector: *mut c_longlong) { - let mut driver = DPI_TARGET.lock().unwrap(); - if let Some(driver) = driver.as_mut() { - *resetvector = driver.e_entry as c_longlong - } -} - -//-------------------------------- -// import functions and wrappers -//-------------------------------- - -mod dpi_export { - use std::ffi::c_char; - extern "C" { - #[cfg(feature = "trace")] - /// `export "DPI-C" function dump_wave(input string file)` - pub fn dump_wave(path: *const c_char); - } -} - -#[cfg(feature = "trace")] -pub(crate) fn dump_wave(scope: crate::svdpi::SvScope, path: &str) { - use crate::svdpi; - let path_cstring = CString::new(path).unwrap(); - - svdpi::set_scope(scope); - unsafe { - dpi_export::dump_wave(path_cstring.as_ptr()); - } -} diff --git a/t1rocketemu/online_dpi/src/drive.rs b/t1rocketemu/online_dpi/src/drive.rs deleted file mode 100644 index 4288cdf70..000000000 --- a/t1rocketemu/online_dpi/src/drive.rs +++ /dev/null @@ -1,409 +0,0 @@ -use crate::dpi::*; -use crate::svdpi::SvScope; -use crate::OfflineArgs; -use crate::{get_t, EXIT_CODE, EXIT_POS}; - -use anyhow::Context; -use common::MEM_SIZE; -use elf::{ - abi::{EM_RISCV, ET_EXEC, PT_LOAD, STT_FUNC}, - endian::LittleEndian, - ElfStream, -}; -use std::collections::HashMap; -use std::os::unix::fs::FileExt; -use std::{fs, path::Path}; -use tracing::{debug, error, info, trace}; - -struct ShadowMem { - mem: Vec, -} - -impl ShadowMem { - pub fn new() -> Self { - Self { mem: vec![0; MEM_SIZE] } - } - - pub fn read_mem(&self, addr: u32, size: u32) -> &[u8] { - let start = addr as usize; - let end = (addr + size) as usize; - &self.mem[start..end] - } - - // size: 1 << arsize - // bus_size: AXI bus width in bytes - // return: Vec with len=bus_size - // if size < bus_size, the result is padded due to AXI narrow transfer rules - pub fn read_mem_axi(&self, addr: u32, size: u32, bus_size: u32) -> Vec { - assert!( - addr % size == 0 && bus_size % size == 0, - "unaligned access addr={addr:#x} size={size}B dlen={bus_size}B" - ); - - let data = self.read_mem(addr, size); - if size < bus_size { - // narrow - let mut data_padded = vec![0; bus_size as usize]; - let start = (addr % bus_size) as usize; - let end = start + data.len(); - data_padded[start..end].copy_from_slice(data); - - data_padded - } else { - // normal - data.to_vec() - } - } - - // size: 1 << awsize - // bus_size: AXI bus width in bytes - // masks: write strokes, len=bus_size - // data: write data, len=bus_size - pub fn write_mem_axi( - &mut self, - addr: u32, - size: u32, - bus_size: u32, - masks: &[bool], - data: &[u8], - ) { - assert!( - addr % size == 0 && bus_size % size == 0, - "unaligned write access addr={addr:#x} size={size}B dlen={bus_size}B" - ); - - // handle strb=0 AXI payload - if !masks.iter().any(|&x| x) { - trace!("Mask 0 write detect"); - return; - } - - // TODO: we do not check strobe is compatible with (addr, awsize) - let addr_align = addr & ((!bus_size) + 1); - - let bus_size = bus_size as usize; - // should not check this, in scalar narrow write, bus_size is not equal to data.len() - // assert_eq!(bus_size, masks.len()); - // assert_eq!(bus_size, data.len()); - - for i in 0..bus_size { - if masks[i] { - self.mem[addr_align as usize + i] = data[i]; - } - } - } -} - -#[derive(Debug)] -#[allow(dead_code)] -pub struct FunctionSym { - #[allow(dead_code)] - pub(crate) name: String, - #[allow(dead_code)] - pub(crate) info: u8, -} -pub type FunctionSymTab = HashMap; - -pub(crate) struct Driver { - // SvScope from t1rocket_cosim_init - scope: SvScope, - - #[cfg(feature = "trace")] - wave_path: String, - #[cfg(feature = "trace")] - dump_start: u64, - #[cfg(feature = "trace")] - dump_end: u64, - #[cfg(feature = "trace")] - dump_started: bool, - - pub(crate) dlen: u32, - pub(crate) e_entry: u64, - - timeout: u64, - last_commit_cycle: u64, - - shadow_mem: ShadowMem, - - pub(crate) quit: bool, -} - -#[cfg(feature = "trace")] -fn parse_range(input: &str) -> (u64, u64) { - if input.is_empty() { - return (0, 0); - } - - let parts: Vec<&str> = input.split(",").collect(); - - if parts.len() != 1 && parts.len() != 2 { - error!("invalid dump wave range: `{input}` was given"); - return (0, 0); - } - - const INVALID_NUMBER: &'static str = "invalid number"; - - if parts.len() == 1 { - return (parts[0].parse().expect(INVALID_NUMBER), 0); - } - - if parts[0].is_empty() { - return (0, parts[1].parse().expect(INVALID_NUMBER)); - } - - let start = parts[0].parse().expect(INVALID_NUMBER); - let end = parts[1].parse().expect(INVALID_NUMBER); - if start > end { - panic!("dump start is larger than end: `{input}`"); - } - - (start, end) -} - -impl Driver { - pub(crate) fn new(scope: SvScope, args: &OfflineArgs) -> Self { - #[cfg(feature = "trace")] - let (dump_start, dump_end) = parse_range(&args.dump_range); - - // pass e_entry to rocket - let (e_entry, shadow_mem, _fn_sym_tab) = - Self::load_elf(&args.common_args.elf_file).expect("fail creating simulator"); - - Self { - scope, - - #[cfg(feature = "trace")] - wave_path: args.wave_path.to_owned(), - #[cfg(feature = "trace")] - dump_start, - #[cfg(feature = "trace")] - dump_end, - #[cfg(feature = "trace")] - dump_started: false, - - dlen: args.common_args.dlen, - e_entry, - - timeout: args.timeout, - last_commit_cycle: 0, - - shadow_mem, - - quit: false, - } - } - - pub fn load_elf(path: &Path) -> anyhow::Result<(u64, ShadowMem, FunctionSymTab)> { - let file = fs::File::open(path).with_context(|| "reading ELF file")?; - let mut elf: ElfStream = - ElfStream::open_stream(&file).with_context(|| "parsing ELF file")?; - - if elf.ehdr.e_machine != EM_RISCV { - anyhow::bail!("ELF is not in RISC-V"); - } - - if elf.ehdr.e_type != ET_EXEC { - anyhow::bail!("ELF is not an executable"); - } - - if elf.ehdr.e_phnum == 0 { - anyhow::bail!("ELF has zero size program header"); - } - - debug!("ELF entry: 0x{:x}", elf.ehdr.e_entry); - let mut mem = ShadowMem::new(); - elf.segments().iter().filter(|phdr| phdr.p_type == PT_LOAD).for_each(|phdr| { - let vaddr: usize = phdr.p_vaddr.try_into().expect("fail converting vaddr(u64) to usize"); - let filesz: usize = phdr.p_filesz.try_into().expect("fail converting p_filesz(u64) to usize"); - debug!( - "Read loadable segments 0x{:x}..0x{:x} to memory 0x{:x}", - phdr.p_offset, - phdr.p_offset + filesz as u64, - vaddr - ); - - // Load file start from offset into given mem slice - // The `offset` of the read_at method is relative to the start of the file and thus independent from the current cursor. - let mem_slice = &mut mem.mem[vaddr..vaddr + filesz]; - file.read_at(mem_slice, phdr.p_offset).unwrap_or_else(|err| { - panic!( - "fail reading ELF into mem with vaddr={}, filesz={}, offset={}. Error detail: {}", - vaddr, filesz, phdr.p_offset, err - ) - }); - }); - - // FIXME: now the symbol table doesn't contain any function value - let mut fn_sym_tab = FunctionSymTab::new(); - let symbol_table = - elf.symbol_table().with_context(|| "reading symbol table(SHT_SYMTAB) from ELF")?; - if let Some((parsed_table, string_table)) = symbol_table { - parsed_table - .iter() - // st_symtype = symbol.st_info & 0xf (But why masking here?) - .filter(|sym| sym.st_symtype() == STT_FUNC) - .for_each(|sym| { - let name = string_table - .get(sym.st_name as usize) - .unwrap_or_else(|_| panic!("fail to get name at st_name={}", sym.st_name)); - fn_sym_tab.insert( - sym.st_value, - FunctionSym { name: name.to_string(), info: sym.st_symtype() }, - ); - }); - } else { - debug!("load_elf: symtab not found"); - }; - - Ok((elf.ehdr.e_entry, mem, fn_sym_tab)) - } - - pub(crate) fn axi_read_high_bandwidth(&mut self, addr: u32, arsize: u64) -> AxiReadPayload { - let size = 1 << arsize; - let data = self.shadow_mem.read_mem_axi(addr, size, self.dlen / 8); - let data_hex = hex::encode(&data); - self.last_commit_cycle = get_t(); - trace!( - "[{}] axi_read_high_bandwidth (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - AxiReadPayload { data } - } - - pub(crate) fn axi_write_high_bandwidth( - &mut self, - addr: u32, - awsize: u64, - strobe: &[bool], - data: &[u8], - ) { - let size = 1 << awsize; - self.shadow_mem.write_mem_axi(addr, size, self.dlen / 8, &strobe, data); - let data_hex = hex::encode(data); - self.last_commit_cycle = get_t(); - trace!( - "[{}] axi_write_high_bandwidth (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - } - - pub(crate) fn axi_read_high_outstanding(&mut self, addr: u32, arsize: u64) -> AxiReadPayload { - let size = 1 << arsize; - assert!(size <= 4); - let data = self.shadow_mem.read_mem_axi(addr, size, 4); - let data_hex = hex::encode(&data); - self.last_commit_cycle = get_t(); - trace!( - "[{}] axi_read_high_outstanding (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - AxiReadPayload { data } - } - - pub(crate) fn axi_write_high_outstanding( - &mut self, - addr: u32, - awsize: u64, - strobe: &[bool], - data: &[u8], - ) { - let size = 1 << awsize; - self.shadow_mem.write_mem_axi(addr, size, 4, strobe, data); - let data_hex = hex::encode(data); - self.last_commit_cycle = get_t(); - trace!( - "[{}] axi_write_high_outstanding (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - } - - pub(crate) fn axi_read_load_store(&mut self, addr: u32, arsize: u64) -> AxiReadPayload { - let size = 1 << arsize; - let bus_size = if size == 32 { 32 } else { 4 }; - let data = self.shadow_mem.read_mem_axi(addr, size, bus_size); - let data_hex = hex::encode(&data); - self.last_commit_cycle = get_t(); - trace!( - "[{}] axi_read_load_store (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - AxiReadPayload { data } - } - - pub(crate) fn axi_write_load_store( - &mut self, - addr: u32, - awsize: u64, - strobe: &[bool], - data: &[u8], - ) { - let size = 1 << awsize; - let bus_size = if size == 32 { 32 } else { 4 }; - self.shadow_mem.write_mem_axi(addr, size, bus_size, strobe, data); - let data_hex = hex::encode(data); - self.last_commit_cycle = get_t(); - - trace!( - "[{}] axi_write_load_store (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - - // check exit with code - if addr == EXIT_POS { - let exit_data_slice = data[..4].try_into().expect("slice with incorrect length"); - if u32::from_le_bytes(exit_data_slice) == EXIT_CODE { - info!("driver is ready to quit"); - self.quit = true; - } - } - } - - pub(crate) fn axi_read_instruction_fetch(&mut self, addr: u32, arsize: u64) -> AxiReadPayload { - let size = 1 << arsize; - let data = self.shadow_mem.read_mem_axi(addr, size, 32); - let data_hex = hex::encode(&data); - trace!( - "[{}] axi_read_instruction_fetch (addr={addr:#x}, size={size}, data={data_hex})", - get_t() - ); - AxiReadPayload { data } - } - - pub(crate) fn watchdog(&mut self) -> u8 { - const WATCHDOG_CONTINUE: u8 = 0; - const WATCHDOG_TIMEOUT: u8 = 1; - - let tick = get_t(); - if tick - self.last_commit_cycle > self.timeout { - error!( - "[{}] watchdog timeout (last_commit_cycle={})", - get_t(), - self.last_commit_cycle - ); - WATCHDOG_TIMEOUT - } else { - #[cfg(feature = "trace")] - if self.dump_end != 0 && tick > self.dump_end { - info!( - "[{tick}] run to dump end, exiting (last_commit_cycle={})", - self.last_commit_cycle - ); - return WATCHDOG_TIMEOUT; - } - - #[cfg(feature = "trace")] - if !self.dump_started && tick >= self.dump_start { - self.start_dump_wave(); - self.dump_started = true; - } - - trace!("[{}] watchdog continue", get_t()); - WATCHDOG_CONTINUE - } - } - - #[cfg(feature = "trace")] - fn start_dump_wave(&mut self) { - dump_wave(self.scope, &self.wave_path); - } -} diff --git a/t1rocketemu/online_dpi/src/lib.rs b/t1rocketemu/online_dpi/src/lib.rs deleted file mode 100644 index 2f875209e..000000000 --- a/t1rocketemu/online_dpi/src/lib.rs +++ /dev/null @@ -1,48 +0,0 @@ -use clap::Parser; -use common::CommonArgs; - -pub mod dpi; -pub mod drive; -pub mod svdpi; -#[cfg(feature = "svvpi")] -pub mod svvpi; - -#[derive(Parser)] -pub(crate) struct OfflineArgs { - #[command(flatten)] - pub common_args: CommonArgs, - - #[cfg(feature = "trace")] - #[arg(long)] - pub wave_path: String, - - #[cfg(feature = "trace")] - #[arg(long, default_value = "")] - pub dump_range: String, - - #[arg(long, default_value_t = 1000000)] - pub timeout: u64, -} - -// quit signal -const EXIT_POS: u32 = 0x4000_0000; -const EXIT_CODE: u32 = 0xdead_beef; - -// keep in sync with TestBench.ClockGen -pub const CYCLE_PERIOD: u64 = 20; - -/// get cycle -#[cfg(any(feature = "sv2023", feature = "svvpi"))] -pub fn get_t() -> u64 { - get_time() / CYCLE_PERIOD -} - -#[cfg(feature = "sv2023")] -pub fn get_time() -> u64 { - svdpi::get_time() -} - -#[cfg(all(not(feature = "sv2023"), feature = "svvpi"))] -pub fn get_time() -> u64 { - svvpi::get_time() -} diff --git a/t1rocketemu/online_dpi/src/svdpi.rs b/t1rocketemu/online_dpi/src/svdpi.rs deleted file mode 100644 index 32d2af9b0..000000000 --- a/t1rocketemu/online_dpi/src/svdpi.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::{ - ffi::{c_void, CString}, - ptr::{self, NonNull}, -}; - -#[rustfmt::skip] -pub mod sys; - -/// get current simulation time in _simulation time unit_ -#[cfg(feature = "sv2023")] -pub fn get_time() -> u64 { - let mut time = sys::svTimeVal { - type_: sys::sv_sim_time as i32, - high: 0, - low: 0, - real: 0.0, - }; - unsafe { - let ret = sys::svGetTime(ptr::null_mut(), &mut time); - assert!(ret == 0, "svGetTime failed"); - } - - ((time.high as u64) << 32) + (time.low as u64) -} - -pub fn set_scope_by_name(name: &str) { - let name_cstr = CString::new(name).unwrap(); - unsafe { - let scope = sys::svGetScopeFromName(name_cstr.as_ptr()); - assert!(!scope.is_null(), "unrecognized scope `{name}`"); - sys::svSetScope(scope); - } -} - -pub fn set_scope(scope: SvScope) { - unsafe { - sys::svSetScope(scope.ptr.as_ptr()); - } -} - -#[derive(Debug, Clone, Copy)] -pub struct SvScope { - ptr: NonNull, -} - -unsafe impl Send for SvScope {} - -impl SvScope { - pub fn get_current() -> Option { - let ptr = unsafe { sys::svGetScope() }; - NonNull::new(ptr).map(|ptr| Self { ptr }) - } -} diff --git a/t1rocketemu/online_dpi/src/svdpi/sys.rs b/t1rocketemu/online_dpi/src/svdpi/sys.rs deleted file mode 100644 index 892d7534b..000000000 --- a/t1rocketemu/online_dpi/src/svdpi/sys.rs +++ /dev/null @@ -1,750 +0,0 @@ -// modified from `bindgen --allowlist-item 'sv.*' svdpi.h` -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -/* automatically generated by rust-bindgen 0.69.4 */ - -pub const sv_0: u32 = 0; -pub const sv_1: u32 = 1; -pub const sv_z: u32 = 2; -pub const sv_x: u32 = 3; -pub const sv_scaled_real_time: u32 = 1; -pub const sv_sim_time: u32 = 2; -pub type svScalar = u8; -pub type svBit = svScalar; -pub type svLogic = svScalar; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_vecval { - pub aval: u32, - pub bval: u32, -} -#[test] -fn bindgen_test_layout_t_vpi_vecval() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(t_vpi_vecval)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(t_vpi_vecval)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).aval) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vecval), - "::", - stringify!(aval) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bval) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vecval), - "::", - stringify!(bval) - ) - ); -} -pub type s_vpi_vecval = t_vpi_vecval; -pub type svLogicVecVal = s_vpi_vecval; -pub type svBitVecVal = u32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_time { - pub type_: i32, - pub high: u32, - pub low: u32, - pub real: f64, -} -#[test] -fn bindgen_test_layout_t_vpi_time() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(t_vpi_time)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_time)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).high) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(high) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).low) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(low) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).real) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(real) - ) - ); -} -pub type s_vpi_time = t_vpi_time; -pub type svTimeVal = s_vpi_time; -extern "C" { - pub fn svDpiVersion() -> *const ::std::os::raw::c_char; -} -pub type svScope = *mut ::std::os::raw::c_void; -pub type svOpenArrayHandle = *mut ::std::os::raw::c_void; -extern "C" { - pub fn svGetBitselBit(s: *const svBitVecVal, i: ::std::os::raw::c_int) -> svBit; -} -extern "C" { - pub fn svGetBitselLogic(s: *const svLogicVecVal, i: ::std::os::raw::c_int) -> svLogic; -} -extern "C" { - pub fn svPutBitselBit(d: *mut svBitVecVal, i: ::std::os::raw::c_int, s: svBit); -} -extern "C" { - pub fn svPutBitselLogic(d: *mut svLogicVecVal, i: ::std::os::raw::c_int, s: svLogic); -} -extern "C" { - pub fn svGetPartselBit( - d: *mut svBitVecVal, - s: *const svBitVecVal, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetPartselLogic( - d: *mut svLogicVecVal, - s: *const svLogicVecVal, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutPartselBit( - d: *mut svBitVecVal, - s: svBitVecVal, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutPartselLogic( - d: *mut svLogicVecVal, - s: svLogicVecVal, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svLeft(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svRight(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svLow(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svHigh(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svIncrement(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svSize(h: svOpenArrayHandle, d: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svDimensions(h: svOpenArrayHandle) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svGetArrayPtr(arg1: svOpenArrayHandle) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svSizeOfArray(arg1: svOpenArrayHandle) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svGetArrElemPtr( - arg1: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ... - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svGetArrElemPtr1( - arg1: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svGetArrElemPtr2( - arg1: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svGetArrElemPtr3( - arg1: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svPutBitArrElemVecVal( - d: svOpenArrayHandle, - s: *const svBitVecVal, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svPutBitArrElem1VecVal( - d: svOpenArrayHandle, - s: *const svBitVecVal, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem2VecVal( - d: svOpenArrayHandle, - s: *const svBitVecVal, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem3VecVal( - d: svOpenArrayHandle, - s: *const svBitVecVal, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElemVecVal( - d: svOpenArrayHandle, - s: *const svLogicVecVal, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svPutLogicArrElem1VecVal( - d: svOpenArrayHandle, - s: *const svLogicVecVal, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElem2VecVal( - d: svOpenArrayHandle, - s: *const svLogicVecVal, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElem3VecVal( - d: svOpenArrayHandle, - s: *const svLogicVecVal, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElemVecVal( - d: *mut svBitVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svGetBitArrElem1VecVal( - d: *mut svBitVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElem2VecVal( - d: *mut svBitVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElem3VecVal( - d: *mut svBitVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElemVecVal( - d: *mut svLogicVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svGetLogicArrElem1VecVal( - d: *mut svLogicVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElem2VecVal( - d: *mut svLogicVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElem3VecVal( - d: *mut svLogicVecVal, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElem(s: svOpenArrayHandle, indx1: ::std::os::raw::c_int, ...) -> svBit; -} -extern "C" { - pub fn svGetBitArrElem1(s: svOpenArrayHandle, indx1: ::std::os::raw::c_int) -> svBit; -} -extern "C" { - pub fn svGetBitArrElem2( - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ) -> svBit; -} -extern "C" { - pub fn svGetBitArrElem3( - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ) -> svBit; -} -extern "C" { - pub fn svGetLogicArrElem(s: svOpenArrayHandle, indx1: ::std::os::raw::c_int, ...) -> svLogic; -} -extern "C" { - pub fn svGetLogicArrElem1(s: svOpenArrayHandle, indx1: ::std::os::raw::c_int) -> svLogic; -} -extern "C" { - pub fn svGetLogicArrElem2( - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ) -> svLogic; -} -extern "C" { - pub fn svGetLogicArrElem3( - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ) -> svLogic; -} -extern "C" { - pub fn svPutLogicArrElem( - d: svOpenArrayHandle, - value: svLogic, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svPutLogicArrElem1(d: svOpenArrayHandle, value: svLogic, indx1: ::std::os::raw::c_int); -} -extern "C" { - pub fn svPutLogicArrElem2( - d: svOpenArrayHandle, - value: svLogic, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElem3( - d: svOpenArrayHandle, - value: svLogic, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem(d: svOpenArrayHandle, value: svBit, indx1: ::std::os::raw::c_int, ...); -} -extern "C" { - pub fn svPutBitArrElem1(d: svOpenArrayHandle, value: svBit, indx1: ::std::os::raw::c_int); -} -extern "C" { - pub fn svPutBitArrElem2( - d: svOpenArrayHandle, - value: svBit, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem3( - d: svOpenArrayHandle, - value: svBit, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetScope() -> svScope; -} -extern "C" { - pub fn svSetScope(scope: svScope) -> svScope; -} -extern "C" { - pub fn svGetNameFromScope(arg1: svScope) -> *const ::std::os::raw::c_char; -} -extern "C" { - pub fn svGetScopeFromName(scopeName: *const ::std::os::raw::c_char) -> svScope; -} -extern "C" { - pub fn svPutUserData( - scope: svScope, - userKey: *mut ::std::os::raw::c_void, - userData: *mut ::std::os::raw::c_void, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svGetUserData( - scope: svScope, - userKey: *mut ::std::os::raw::c_void, - ) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn svGetCallerInfo( - fileName: *mut *const ::std::os::raw::c_char, - lineNumber: *mut ::std::os::raw::c_int, - ) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svIsDisabledState() -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svAckDisabledState(); -} -#[cfg(feature = "sv2023")] -extern "C" { - pub fn svGetTime(scope: svScope, time: *mut svTimeVal) -> ::std::os::raw::c_int; -} -#[cfg(feature = "sv2023")] -extern "C" { - pub fn svGetTimeUnit(scope: svScope, time_unit: *mut i32) -> ::std::os::raw::c_int; -} -#[cfg(feature = "sv2023")] -extern "C" { - pub fn svGetTimePrecision(scope: svScope, time_precision: *mut i32) -> ::std::os::raw::c_int; -} -pub type svBitVec32 = ::std::os::raw::c_uint; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct svLogicVec32 { - pub c: ::std::os::raw::c_uint, - pub d: ::std::os::raw::c_uint, -} -#[test] -fn bindgen_test_layout_svLogicVec32() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(svLogicVec32)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(svLogicVec32)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).c) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(svLogicVec32), - "::", - stringify!(c) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(svLogicVec32), - "::", - stringify!(d) - ) - ); -} -pub type svBitPackedArrRef = *mut ::std::os::raw::c_void; -pub type svLogicPackedArrRef = *mut ::std::os::raw::c_void; -extern "C" { - pub fn svSizeOfBitPackedArr(width: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svSizeOfLogicPackedArr(width: ::std::os::raw::c_int) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn svPutBitVec32(d: svBitPackedArrRef, s: *const svBitVec32, w: ::std::os::raw::c_int); -} -extern "C" { - pub fn svPutLogicVec32( - d: svLogicPackedArrRef, - s: *const svLogicVec32, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitVec32(d: *mut svBitVec32, s: svBitPackedArrRef, w: ::std::os::raw::c_int); -} -extern "C" { - pub fn svGetLogicVec32(d: *mut svLogicVec32, s: svLogicPackedArrRef, w: ::std::os::raw::c_int); -} -extern "C" { - pub fn svGetSelectBit(s: svBitPackedArrRef, i: ::std::os::raw::c_int) -> svBit; -} -extern "C" { - pub fn svGetSelectLogic(s: svLogicPackedArrRef, i: ::std::os::raw::c_int) -> svLogic; -} -extern "C" { - pub fn svPutSelectBit(d: svBitPackedArrRef, i: ::std::os::raw::c_int, s: svBit); -} -extern "C" { - pub fn svPutSelectLogic(d: svLogicPackedArrRef, i: ::std::os::raw::c_int, s: svLogic); -} -extern "C" { - pub fn svGetPartSelectBit( - d: *mut svBitVec32, - s: svBitPackedArrRef, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBits( - s: svBitPackedArrRef, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ) -> svBitVec32; -} -extern "C" { - pub fn svGet32Bits(s: svBitPackedArrRef, i: ::std::os::raw::c_int) -> svBitVec32; -} -extern "C" { - pub fn svGet64Bits(s: svBitPackedArrRef, i: ::std::os::raw::c_int) -> u64; -} -extern "C" { - pub fn svGetPartSelectLogic( - d: *mut svLogicVec32, - s: svLogicPackedArrRef, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutPartSelectBit( - d: svBitPackedArrRef, - s: svBitVec32, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutPartSelectLogic( - d: svLogicPackedArrRef, - s: *const svLogicVec32, - i: ::std::os::raw::c_int, - w: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElemVec32( - d: svOpenArrayHandle, - s: *const svBitVec32, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svPutBitArrElem1Vec32( - d: svOpenArrayHandle, - s: *const svBitVec32, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem2Vec32( - d: svOpenArrayHandle, - s: *const svBitVec32, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutBitArrElem3Vec32( - d: svOpenArrayHandle, - s: *const svBitVec32, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElemVec32( - d: svOpenArrayHandle, - s: *const svLogicVec32, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svPutLogicArrElem1Vec32( - d: svOpenArrayHandle, - s: *const svLogicVec32, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElem2Vec32( - d: svOpenArrayHandle, - s: *const svLogicVec32, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svPutLogicArrElem3Vec32( - d: svOpenArrayHandle, - s: *const svLogicVec32, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElemVec32( - d: *mut svBitVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svGetBitArrElem1Vec32( - d: *mut svBitVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElem2Vec32( - d: *mut svBitVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetBitArrElem3Vec32( - d: *mut svBitVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElemVec32( - d: *mut svLogicVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ... - ); -} -extern "C" { - pub fn svGetLogicArrElem1Vec32( - d: *mut svLogicVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElem2Vec32( - d: *mut svLogicVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - ); -} -extern "C" { - pub fn svGetLogicArrElem3Vec32( - d: *mut svLogicVec32, - s: svOpenArrayHandle, - indx1: ::std::os::raw::c_int, - indx2: ::std::os::raw::c_int, - indx3: ::std::os::raw::c_int, - ); -} diff --git a/t1rocketemu/online_dpi/src/svvpi.rs b/t1rocketemu/online_dpi/src/svvpi.rs deleted file mode 100644 index f0cd8b8bd..000000000 --- a/t1rocketemu/online_dpi/src/svvpi.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[rustfmt::skip] -pub mod sys; - -use std::ptr; - -/// get current simulation time in _simulation time unit_ -pub fn get_time() -> u64 { - let mut time = sys::s_vpi_time { - type_: sys::vpiSimTime as i32, - high: 0, - low: 0, - real: 0.0, - }; - unsafe { - sys::vpi_get_time(ptr::null_mut(), &mut time); - } - ((time.high as u64) << 32) + (time.low as u64) -} diff --git a/t1rocketemu/online_dpi/src/svvpi/sys.rs b/t1rocketemu/online_dpi/src/svvpi/sys.rs deleted file mode 100644 index c3d269855..000000000 --- a/t1rocketemu/online_dpi/src/svvpi/sys.rs +++ /dev/null @@ -1,2102 +0,0 @@ -// modified from `bindgen --allowlist-item 'vpi.*' sv_vpi_user.h` -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -/* automatically generated by rust-bindgen 0.69.4 */ - -pub const vpiAlways: u32 = 1; -pub const vpiAssignStmt: u32 = 2; -pub const vpiAssignment: u32 = 3; -pub const vpiBegin: u32 = 4; -pub const vpiCase: u32 = 5; -pub const vpiCaseItem: u32 = 6; -pub const vpiConstant: u32 = 7; -pub const vpiContAssign: u32 = 8; -pub const vpiDeassign: u32 = 9; -pub const vpiDefParam: u32 = 10; -pub const vpiDelayControl: u32 = 11; -pub const vpiDisable: u32 = 12; -pub const vpiEventControl: u32 = 13; -pub const vpiEventStmt: u32 = 14; -pub const vpiFor: u32 = 15; -pub const vpiForce: u32 = 16; -pub const vpiForever: u32 = 17; -pub const vpiFork: u32 = 18; -pub const vpiFuncCall: u32 = 19; -pub const vpiFunction: u32 = 20; -pub const vpiGate: u32 = 21; -pub const vpiIf: u32 = 22; -pub const vpiIfElse: u32 = 23; -pub const vpiInitial: u32 = 24; -pub const vpiIntegerVar: u32 = 25; -pub const vpiInterModPath: u32 = 26; -pub const vpiIterator: u32 = 27; -pub const vpiIODecl: u32 = 28; -pub const vpiMemory: u32 = 29; -pub const vpiMemoryWord: u32 = 30; -pub const vpiModPath: u32 = 31; -pub const vpiModule: u32 = 32; -pub const vpiNamedBegin: u32 = 33; -pub const vpiNamedEvent: u32 = 34; -pub const vpiNamedFork: u32 = 35; -pub const vpiNet: u32 = 36; -pub const vpiNetBit: u32 = 37; -pub const vpiNullStmt: u32 = 38; -pub const vpiOperation: u32 = 39; -pub const vpiParamAssign: u32 = 40; -pub const vpiParameter: u32 = 41; -pub const vpiPartSelect: u32 = 42; -pub const vpiPathTerm: u32 = 43; -pub const vpiPort: u32 = 44; -pub const vpiPortBit: u32 = 45; -pub const vpiPrimTerm: u32 = 46; -pub const vpiRealVar: u32 = 47; -pub const vpiReg: u32 = 48; -pub const vpiRegBit: u32 = 49; -pub const vpiRelease: u32 = 50; -pub const vpiRepeat: u32 = 51; -pub const vpiRepeatControl: u32 = 52; -pub const vpiSchedEvent: u32 = 53; -pub const vpiSpecParam: u32 = 54; -pub const vpiSwitch: u32 = 55; -pub const vpiSysFuncCall: u32 = 56; -pub const vpiSysTaskCall: u32 = 57; -pub const vpiTableEntry: u32 = 58; -pub const vpiTask: u32 = 59; -pub const vpiTaskCall: u32 = 60; -pub const vpiTchk: u32 = 61; -pub const vpiTchkTerm: u32 = 62; -pub const vpiTimeVar: u32 = 63; -pub const vpiTimeQueue: u32 = 64; -pub const vpiUdp: u32 = 65; -pub const vpiUdpDefn: u32 = 66; -pub const vpiUserSystf: u32 = 67; -pub const vpiVarSelect: u32 = 68; -pub const vpiWait: u32 = 69; -pub const vpiWhile: u32 = 70; -pub const vpiAttribute: u32 = 105; -pub const vpiBitSelect: u32 = 106; -pub const vpiCallback: u32 = 107; -pub const vpiDelayTerm: u32 = 108; -pub const vpiDelayDevice: u32 = 109; -pub const vpiFrame: u32 = 110; -pub const vpiGateArray: u32 = 111; -pub const vpiModuleArray: u32 = 112; -pub const vpiPrimitiveArray: u32 = 113; -pub const vpiNetArray: u32 = 114; -pub const vpiRange: u32 = 115; -pub const vpiRegArray: u32 = 116; -pub const vpiSwitchArray: u32 = 117; -pub const vpiUdpArray: u32 = 118; -pub const vpiContAssignBit: u32 = 128; -pub const vpiNamedEventArray: u32 = 129; -pub const vpiIndexedPartSelect: u32 = 130; -pub const vpiGenScopeArray: u32 = 133; -pub const vpiGenScope: u32 = 134; -pub const vpiGenVar: u32 = 135; -pub const vpiCondition: u32 = 71; -pub const vpiDelay: u32 = 72; -pub const vpiElseStmt: u32 = 73; -pub const vpiForIncStmt: u32 = 74; -pub const vpiForInitStmt: u32 = 75; -pub const vpiHighConn: u32 = 76; -pub const vpiLhs: u32 = 77; -pub const vpiIndex: u32 = 78; -pub const vpiLeftRange: u32 = 79; -pub const vpiLowConn: u32 = 80; -pub const vpiParent: u32 = 81; -pub const vpiRhs: u32 = 82; -pub const vpiRightRange: u32 = 83; -pub const vpiScope: u32 = 84; -pub const vpiSysTfCall: u32 = 85; -pub const vpiTchkDataTerm: u32 = 86; -pub const vpiTchkNotifier: u32 = 87; -pub const vpiTchkRefTerm: u32 = 88; -pub const vpiArgument: u32 = 89; -pub const vpiBit: u32 = 90; -pub const vpiDriver: u32 = 91; -pub const vpiInternalScope: u32 = 92; -pub const vpiLoad: u32 = 93; -pub const vpiModDataPathIn: u32 = 94; -pub const vpiModPathIn: u32 = 95; -pub const vpiModPathOut: u32 = 96; -pub const vpiOperand: u32 = 97; -pub const vpiPortInst: u32 = 98; -pub const vpiProcess: u32 = 99; -pub const vpiVariables: u32 = 100; -pub const vpiUse: u32 = 101; -pub const vpiExpr: u32 = 102; -pub const vpiPrimitive: u32 = 103; -pub const vpiStmt: u32 = 104; -pub const vpiActiveTimeFormat: u32 = 119; -pub const vpiInTerm: u32 = 120; -pub const vpiInstanceArray: u32 = 121; -pub const vpiLocalDriver: u32 = 122; -pub const vpiLocalLoad: u32 = 123; -pub const vpiOutTerm: u32 = 124; -pub const vpiPorts: u32 = 125; -pub const vpiSimNet: u32 = 126; -pub const vpiTaskFunc: u32 = 127; -pub const vpiBaseExpr: u32 = 131; -pub const vpiWidthExpr: u32 = 132; -pub const vpiAutomatics: u32 = 136; -pub const vpiUndefined: i32 = -1; -pub const vpiType: u32 = 1; -pub const vpiName: u32 = 2; -pub const vpiFullName: u32 = 3; -pub const vpiSize: u32 = 4; -pub const vpiFile: u32 = 5; -pub const vpiLineNo: u32 = 6; -pub const vpiTopModule: u32 = 7; -pub const vpiCellInstance: u32 = 8; -pub const vpiDefName: u32 = 9; -pub const vpiProtected: u32 = 10; -pub const vpiTimeUnit: u32 = 11; -pub const vpiTimePrecision: u32 = 12; -pub const vpiDefNetType: u32 = 13; -pub const vpiUnconnDrive: u32 = 14; -pub const vpiHighZ: u32 = 1; -pub const vpiPull1: u32 = 2; -pub const vpiPull0: u32 = 3; -pub const vpiDefFile: u32 = 15; -pub const vpiDefLineNo: u32 = 16; -pub const vpiDefDelayMode: u32 = 47; -pub const vpiDelayModeNone: u32 = 1; -pub const vpiDelayModePath: u32 = 2; -pub const vpiDelayModeDistrib: u32 = 3; -pub const vpiDelayModeUnit: u32 = 4; -pub const vpiDelayModeZero: u32 = 5; -pub const vpiDelayModeMTM: u32 = 6; -pub const vpiDefDecayTime: u32 = 48; -pub const vpiScalar: u32 = 17; -pub const vpiVector: u32 = 18; -pub const vpiExplicitName: u32 = 19; -pub const vpiDirection: u32 = 20; -pub const vpiInput: u32 = 1; -pub const vpiOutput: u32 = 2; -pub const vpiInout: u32 = 3; -pub const vpiMixedIO: u32 = 4; -pub const vpiNoDirection: u32 = 5; -pub const vpiConnByName: u32 = 21; -pub const vpiNetType: u32 = 22; -pub const vpiWire: u32 = 1; -pub const vpiWand: u32 = 2; -pub const vpiWor: u32 = 3; -pub const vpiTri: u32 = 4; -pub const vpiTri0: u32 = 5; -pub const vpiTri1: u32 = 6; -pub const vpiTriReg: u32 = 7; -pub const vpiTriAnd: u32 = 8; -pub const vpiTriOr: u32 = 9; -pub const vpiSupply1: u32 = 10; -pub const vpiSupply0: u32 = 11; -pub const vpiNone: u32 = 12; -pub const vpiUwire: u32 = 13; -pub const vpiNettypeNet: u32 = 14; -pub const vpiNettypeNetSelect: u32 = 15; -pub const vpiInterconnect: u32 = 16; -pub const vpiExplicitScalared: u32 = 23; -pub const vpiExplicitVectored: u32 = 24; -pub const vpiExpanded: u32 = 25; -pub const vpiImplicitDecl: u32 = 26; -pub const vpiChargeStrength: u32 = 27; -pub const vpiArray: u32 = 28; -pub const vpiPortIndex: u32 = 29; -pub const vpiTermIndex: u32 = 30; -pub const vpiStrength0: u32 = 31; -pub const vpiStrength1: u32 = 32; -pub const vpiPrimType: u32 = 33; -pub const vpiAndPrim: u32 = 1; -pub const vpiNandPrim: u32 = 2; -pub const vpiNorPrim: u32 = 3; -pub const vpiOrPrim: u32 = 4; -pub const vpiXorPrim: u32 = 5; -pub const vpiXnorPrim: u32 = 6; -pub const vpiBufPrim: u32 = 7; -pub const vpiNotPrim: u32 = 8; -pub const vpiBufif0Prim: u32 = 9; -pub const vpiBufif1Prim: u32 = 10; -pub const vpiNotif0Prim: u32 = 11; -pub const vpiNotif1Prim: u32 = 12; -pub const vpiNmosPrim: u32 = 13; -pub const vpiPmosPrim: u32 = 14; -pub const vpiCmosPrim: u32 = 15; -pub const vpiRnmosPrim: u32 = 16; -pub const vpiRpmosPrim: u32 = 17; -pub const vpiRcmosPrim: u32 = 18; -pub const vpiRtranPrim: u32 = 19; -pub const vpiRtranif0Prim: u32 = 20; -pub const vpiRtranif1Prim: u32 = 21; -pub const vpiTranPrim: u32 = 22; -pub const vpiTranif0Prim: u32 = 23; -pub const vpiTranif1Prim: u32 = 24; -pub const vpiPullupPrim: u32 = 25; -pub const vpiPulldownPrim: u32 = 26; -pub const vpiSeqPrim: u32 = 27; -pub const vpiCombPrim: u32 = 28; -pub const vpiPolarity: u32 = 34; -pub const vpiDataPolarity: u32 = 35; -pub const vpiPositive: u32 = 1; -pub const vpiNegative: u32 = 2; -pub const vpiUnknown: u32 = 3; -pub const vpiEdge: u32 = 36; -pub const vpiNoEdge: u32 = 0; -pub const vpiEdge01: u32 = 1; -pub const vpiEdge10: u32 = 2; -pub const vpiEdge0x: u32 = 4; -pub const vpiEdgex1: u32 = 8; -pub const vpiEdge1x: u32 = 16; -pub const vpiEdgex0: u32 = 32; -pub const vpiPosedge: u32 = 13; -pub const vpiNegedge: u32 = 50; -pub const vpiAnyEdge: u32 = 63; -pub const vpiPathType: u32 = 37; -pub const vpiPathFull: u32 = 1; -pub const vpiPathParallel: u32 = 2; -pub const vpiTchkType: u32 = 38; -pub const vpiSetup: u32 = 1; -pub const vpiHold: u32 = 2; -pub const vpiPeriod: u32 = 3; -pub const vpiWidth: u32 = 4; -pub const vpiSkew: u32 = 5; -pub const vpiRecovery: u32 = 6; -pub const vpiNoChange: u32 = 7; -pub const vpiSetupHold: u32 = 8; -pub const vpiFullskew: u32 = 9; -pub const vpiRecrem: u32 = 10; -pub const vpiRemoval: u32 = 11; -pub const vpiTimeskew: u32 = 12; -pub const vpiOpType: u32 = 39; -pub const vpiMinusOp: u32 = 1; -pub const vpiPlusOp: u32 = 2; -pub const vpiNotOp: u32 = 3; -pub const vpiBitNegOp: u32 = 4; -pub const vpiUnaryAndOp: u32 = 5; -pub const vpiUnaryNandOp: u32 = 6; -pub const vpiUnaryOrOp: u32 = 7; -pub const vpiUnaryNorOp: u32 = 8; -pub const vpiUnaryXorOp: u32 = 9; -pub const vpiUnaryXNorOp: u32 = 10; -pub const vpiSubOp: u32 = 11; -pub const vpiDivOp: u32 = 12; -pub const vpiModOp: u32 = 13; -pub const vpiEqOp: u32 = 14; -pub const vpiNeqOp: u32 = 15; -pub const vpiCaseEqOp: u32 = 16; -pub const vpiCaseNeqOp: u32 = 17; -pub const vpiGtOp: u32 = 18; -pub const vpiGeOp: u32 = 19; -pub const vpiLtOp: u32 = 20; -pub const vpiLeOp: u32 = 21; -pub const vpiLShiftOp: u32 = 22; -pub const vpiRShiftOp: u32 = 23; -pub const vpiAddOp: u32 = 24; -pub const vpiMultOp: u32 = 25; -pub const vpiLogAndOp: u32 = 26; -pub const vpiLogOrOp: u32 = 27; -pub const vpiBitAndOp: u32 = 28; -pub const vpiBitOrOp: u32 = 29; -pub const vpiBitXorOp: u32 = 30; -pub const vpiBitXNorOp: u32 = 31; -pub const vpiBitXnorOp: u32 = 31; -pub const vpiConditionOp: u32 = 32; -pub const vpiConcatOp: u32 = 33; -pub const vpiMultiConcatOp: u32 = 34; -pub const vpiEventOrOp: u32 = 35; -pub const vpiNullOp: u32 = 36; -pub const vpiListOp: u32 = 37; -pub const vpiMinTypMaxOp: u32 = 38; -pub const vpiPosedgeOp: u32 = 39; -pub const vpiNegedgeOp: u32 = 40; -pub const vpiArithLShiftOp: u32 = 41; -pub const vpiArithRShiftOp: u32 = 42; -pub const vpiPowerOp: u32 = 43; -pub const vpiConstType: u32 = 40; -pub const vpiDecConst: u32 = 1; -pub const vpiRealConst: u32 = 2; -pub const vpiBinaryConst: u32 = 3; -pub const vpiOctConst: u32 = 4; -pub const vpiHexConst: u32 = 5; -pub const vpiStringConst: u32 = 6; -pub const vpiIntConst: u32 = 7; -pub const vpiTimeConst: u32 = 8; -pub const vpiBlocking: u32 = 41; -pub const vpiCaseType: u32 = 42; -pub const vpiCaseExact: u32 = 1; -pub const vpiCaseX: u32 = 2; -pub const vpiCaseZ: u32 = 3; -pub const vpiNetDeclAssign: u32 = 43; -pub const vpiFuncType: u32 = 44; -pub const vpiIntFunc: u32 = 1; -pub const vpiRealFunc: u32 = 2; -pub const vpiTimeFunc: u32 = 3; -pub const vpiSizedFunc: u32 = 4; -pub const vpiSizedSignedFunc: u32 = 5; -pub const vpiSysFuncType: u32 = 44; -pub const vpiSysFuncInt: u32 = 1; -pub const vpiSysFuncReal: u32 = 2; -pub const vpiSysFuncTime: u32 = 3; -pub const vpiSysFuncSized: u32 = 4; -pub const vpiUserDefn: u32 = 45; -pub const vpiScheduled: u32 = 46; -pub const vpiActive: u32 = 49; -pub const vpiAutomatic: u32 = 50; -pub const vpiCell: u32 = 51; -pub const vpiConfig: u32 = 52; -pub const vpiConstantSelect: u32 = 53; -pub const vpiDecompile: u32 = 54; -pub const vpiDefAttribute: u32 = 55; -pub const vpiDelayType: u32 = 56; -pub const vpiModPathDelay: u32 = 1; -pub const vpiInterModPathDelay: u32 = 2; -pub const vpiMIPDelay: u32 = 3; -pub const vpiIteratorType: u32 = 57; -pub const vpiLibrary: u32 = 58; -pub const vpiOffset: u32 = 60; -pub const vpiResolvedNetType: u32 = 61; -pub const vpiSaveRestartID: u32 = 62; -pub const vpiSaveRestartLocation: u32 = 63; -pub const vpiValid: u32 = 64; -pub const vpiValidFalse: u32 = 0; -pub const vpiValidTrue: u32 = 1; -pub const vpiSigned: u32 = 65; -pub const vpiLocalParam: u32 = 70; -pub const vpiModPathHasIfNone: u32 = 71; -pub const vpiIndexedPartSelectType: u32 = 72; -pub const vpiPosIndexed: u32 = 1; -pub const vpiNegIndexed: u32 = 2; -pub const vpiIsMemory: u32 = 73; -pub const vpiIsProtected: u32 = 74; -pub const vpiStop: u32 = 66; -pub const vpiFinish: u32 = 67; -pub const vpiReset: u32 = 68; -pub const vpiSetInteractiveScope: u32 = 69; -pub const vpiScaledRealTime: u32 = 1; -pub const vpiSimTime: u32 = 2; -pub const vpiSuppressTime: u32 = 3; -pub const vpiSupplyDrive: u32 = 128; -pub const vpiStrongDrive: u32 = 64; -pub const vpiPullDrive: u32 = 32; -pub const vpiWeakDrive: u32 = 8; -pub const vpiLargeCharge: u32 = 16; -pub const vpiMediumCharge: u32 = 4; -pub const vpiSmallCharge: u32 = 2; -pub const vpiHiZ: u32 = 1; -pub const vpiBinStrVal: u32 = 1; -pub const vpiOctStrVal: u32 = 2; -pub const vpiDecStrVal: u32 = 3; -pub const vpiHexStrVal: u32 = 4; -pub const vpiScalarVal: u32 = 5; -pub const vpiIntVal: u32 = 6; -pub const vpiRealVal: u32 = 7; -pub const vpiStringVal: u32 = 8; -pub const vpiVectorVal: u32 = 9; -pub const vpiStrengthVal: u32 = 10; -pub const vpiTimeVal: u32 = 11; -pub const vpiObjTypeVal: u32 = 12; -pub const vpiSuppressVal: u32 = 13; -pub const vpiShortIntVal: u32 = 14; -pub const vpiLongIntVal: u32 = 15; -pub const vpiShortRealVal: u32 = 16; -pub const vpiRawTwoStateVal: u32 = 17; -pub const vpiRawFourStateVal: u32 = 18; -pub const vpiNoDelay: u32 = 1; -pub const vpiInertialDelay: u32 = 2; -pub const vpiTransportDelay: u32 = 3; -pub const vpiPureTransportDelay: u32 = 4; -pub const vpiForceFlag: u32 = 5; -pub const vpiReleaseFlag: u32 = 6; -pub const vpiCancelEvent: u32 = 7; -pub const vpiReturnEvent: u32 = 4096; -pub const vpiUserAllocFlag: u32 = 8192; -pub const vpiOneValue: u32 = 16384; -pub const vpiPropagateOff: u32 = 32768; -pub const vpi0: u32 = 0; -pub const vpi1: u32 = 1; -pub const vpiZ: u32 = 2; -pub const vpiX: u32 = 3; -pub const vpiH: u32 = 4; -pub const vpiL: u32 = 5; -pub const vpiDontCare: u32 = 6; -pub const vpiSysTask: u32 = 1; -pub const vpiSysFunc: u32 = 2; -pub const vpiCompile: u32 = 1; -pub const vpiPLI: u32 = 2; -pub const vpiRun: u32 = 3; -pub const vpiNotice: u32 = 1; -pub const vpiWarning: u32 = 2; -pub const vpiError: u32 = 3; -pub const vpiSystem: u32 = 4; -pub const vpiInternal: u32 = 5; -pub const vpiPackage: u32 = 600; -pub const vpiInterface: u32 = 601; -pub const vpiProgram: u32 = 602; -pub const vpiInterfaceArray: u32 = 603; -pub const vpiProgramArray: u32 = 604; -pub const vpiTypespec: u32 = 605; -pub const vpiModport: u32 = 606; -pub const vpiInterfaceTfDecl: u32 = 607; -pub const vpiRefObj: u32 = 608; -pub const vpiTypeParameter: u32 = 609; -pub const vpiVarBit: u32 = 49; -pub const vpiLongIntVar: u32 = 610; -pub const vpiShortIntVar: u32 = 611; -pub const vpiIntVar: u32 = 612; -pub const vpiShortRealVar: u32 = 613; -pub const vpiByteVar: u32 = 614; -pub const vpiClassVar: u32 = 615; -pub const vpiStringVar: u32 = 616; -pub const vpiEnumVar: u32 = 617; -pub const vpiStructVar: u32 = 618; -pub const vpiUnionVar: u32 = 619; -pub const vpiBitVar: u32 = 620; -pub const vpiLogicVar: u32 = 48; -pub const vpiArrayVar: u32 = 116; -pub const vpiClassObj: u32 = 621; -pub const vpiChandleVar: u32 = 622; -pub const vpiPackedArrayVar: u32 = 623; -pub const vpiVirtualInterfaceVar: u32 = 728; -pub const vpiLongIntTypespec: u32 = 625; -pub const vpiShortRealTypespec: u32 = 626; -pub const vpiByteTypespec: u32 = 627; -pub const vpiShortIntTypespec: u32 = 628; -pub const vpiIntTypespec: u32 = 629; -pub const vpiClassTypespec: u32 = 630; -pub const vpiStringTypespec: u32 = 631; -pub const vpiChandleTypespec: u32 = 632; -pub const vpiEnumTypespec: u32 = 633; -pub const vpiEnumConst: u32 = 634; -pub const vpiIntegerTypespec: u32 = 635; -pub const vpiTimeTypespec: u32 = 636; -pub const vpiRealTypespec: u32 = 637; -pub const vpiStructTypespec: u32 = 638; -pub const vpiUnionTypespec: u32 = 639; -pub const vpiBitTypespec: u32 = 640; -pub const vpiLogicTypespec: u32 = 641; -pub const vpiArrayTypespec: u32 = 642; -pub const vpiVoidTypespec: u32 = 643; -pub const vpiTypespecMember: u32 = 644; -pub const vpiPackedArrayTypespec: u32 = 692; -pub const vpiSequenceTypespec: u32 = 696; -pub const vpiPropertyTypespec: u32 = 697; -pub const vpiEventTypespec: u32 = 698; -pub const vpiInterfaceTypespec: u32 = 906; -pub const vpiClockingBlock: u32 = 650; -pub const vpiClockingIODecl: u32 = 651; -pub const vpiClassDefn: u32 = 652; -pub const vpiConstraint: u32 = 653; -pub const vpiConstraintOrdering: u32 = 654; -pub const vpiDistItem: u32 = 645; -pub const vpiAliasStmt: u32 = 646; -pub const vpiThread: u32 = 647; -pub const vpiMethodFuncCall: u32 = 648; -pub const vpiMethodTaskCall: u32 = 649; -pub const vpiAssert: u32 = 686; -pub const vpiAssume: u32 = 687; -pub const vpiCover: u32 = 688; -pub const vpiRestrict: u32 = 901; -pub const vpiDisableCondition: u32 = 689; -pub const vpiClockingEvent: u32 = 690; -pub const vpiPropertyDecl: u32 = 655; -pub const vpiPropertySpec: u32 = 656; -pub const vpiPropertyExpr: u32 = 657; -pub const vpiMulticlockSequenceExpr: u32 = 658; -pub const vpiClockedSeq: u32 = 659; -pub const vpiClockedProp: u32 = 902; -pub const vpiPropertyInst: u32 = 660; -pub const vpiSequenceDecl: u32 = 661; -pub const vpiCaseProperty: u32 = 662; -pub const vpiCasePropertyItem: u32 = 905; -pub const vpiSequenceInst: u32 = 664; -pub const vpiImmediateAssert: u32 = 665; -pub const vpiImmediateAssume: u32 = 694; -pub const vpiImmediateCover: u32 = 695; -pub const vpiReturn: u32 = 666; -pub const vpiAnyPattern: u32 = 667; -pub const vpiTaggedPattern: u32 = 668; -pub const vpiStructPattern: u32 = 669; -pub const vpiDoWhile: u32 = 670; -pub const vpiOrderedWait: u32 = 671; -pub const vpiWaitFork: u32 = 672; -pub const vpiDisableFork: u32 = 673; -pub const vpiExpectStmt: u32 = 674; -pub const vpiForeachStmt: u32 = 675; -pub const vpiReturnStmt: u32 = 691; -pub const vpiFinal: u32 = 676; -pub const vpiExtends: u32 = 677; -pub const vpiDistribution: u32 = 678; -pub const vpiSeqFormalDecl: u32 = 679; -pub const vpiPropFormalDecl: u32 = 699; -pub const vpiArrayNet: u32 = 114; -pub const vpiEnumNet: u32 = 680; -pub const vpiIntegerNet: u32 = 681; -pub const vpiLogicNet: u32 = 36; -pub const vpiTimeNet: u32 = 682; -pub const vpiUnionNet: u32 = 525; -pub const vpiShortRealNet: u32 = 526; -pub const vpiRealNet: u32 = 527; -pub const vpiByteNet: u32 = 528; -pub const vpiShortIntNet: u32 = 529; -pub const vpiIntNet: u32 = 530; -pub const vpiLongIntNet: u32 = 531; -pub const vpiBitNet: u32 = 532; -pub const vpiInterconnectNet: u32 = 533; -pub const vpiInterconnectArray: u32 = 534; -pub const vpiStructNet: u32 = 683; -pub const vpiBreak: u32 = 684; -pub const vpiContinue: u32 = 685; -pub const vpiPackedArrayNet: u32 = 693; -pub const vpiNettypeDecl: u32 = 523; -pub const vpiConstraintExpr: u32 = 747; -pub const vpiElseConst: u32 = 748; -pub const vpiImplication: u32 = 749; -pub const vpiConstrIf: u32 = 738; -pub const vpiConstrIfElse: u32 = 739; -pub const vpiConstrForEach: u32 = 736; -pub const vpiSoftDisable: u32 = 733; -pub const vpiLetDecl: u32 = 903; -pub const vpiLetExpr: u32 = 904; -pub const vpiActual: u32 = 700; -pub const vpiTypedefAlias: u32 = 701; -pub const vpiIndexTypespec: u32 = 702; -pub const vpiBaseTypespec: u32 = 703; -pub const vpiElemTypespec: u32 = 704; -pub const vpiNetTypedefAlias: u32 = 705; -pub const vpiInputSkew: u32 = 706; -pub const vpiOutputSkew: u32 = 707; -pub const vpiGlobalClocking: u32 = 708; -pub const vpiDefaultClocking: u32 = 709; -pub const vpiDefaultDisableIff: u32 = 710; -pub const vpiOrigin: u32 = 713; -pub const vpiPrefix: u32 = 714; -pub const vpiWith: u32 = 715; -pub const vpiProperty: u32 = 718; -pub const vpiValueRange: u32 = 720; -pub const vpiPattern: u32 = 721; -pub const vpiWeight: u32 = 722; -pub const vpiConstraintItem: u32 = 746; -pub const vpiTypedef: u32 = 725; -pub const vpiImport: u32 = 726; -pub const vpiDerivedClasses: u32 = 727; -pub const vpiInterfaceDecl: u32 = 728; -pub const vpiMethods: u32 = 730; -pub const vpiSolveBefore: u32 = 731; -pub const vpiSolveAfter: u32 = 732; -pub const vpiWaitingProcesses: u32 = 734; -pub const vpiMessages: u32 = 735; -pub const vpiLoopVars: u32 = 737; -pub const vpiConcurrentAssertion: u32 = 740; -pub const vpiConcurrentAssertions: u32 = 740; -pub const vpiMatchItem: u32 = 741; -pub const vpiMember: u32 = 742; -pub const vpiElement: u32 = 743; -pub const vpiAssertion: u32 = 744; -pub const vpiInstance: u32 = 745; -pub const vpiTop: u32 = 600; -pub const vpiUnit: u32 = 602; -pub const vpiJoinType: u32 = 603; -pub const vpiJoin: u32 = 0; -pub const vpiJoinNone: u32 = 1; -pub const vpiJoinAny: u32 = 2; -pub const vpiAccessType: u32 = 604; -pub const vpiForkJoinAcc: u32 = 1; -pub const vpiExternAcc: u32 = 2; -pub const vpiDPIExportAcc: u32 = 3; -pub const vpiDPIImportAcc: u32 = 4; -pub const vpiArrayType: u32 = 606; -pub const vpiStaticArray: u32 = 1; -pub const vpiDynamicArray: u32 = 2; -pub const vpiAssocArray: u32 = 3; -pub const vpiQueueArray: u32 = 4; -pub const vpiArrayMember: u32 = 607; -pub const vpiIsRandomized: u32 = 608; -pub const vpiLocalVarDecls: u32 = 609; -pub const vpiOpStrong: u32 = 656; -pub const vpiRandType: u32 = 610; -pub const vpiNotRand: u32 = 1; -pub const vpiRand: u32 = 2; -pub const vpiRandC: u32 = 3; -pub const vpiPortType: u32 = 611; -pub const vpiInterfacePort: u32 = 1; -pub const vpiModportPort: u32 = 2; -pub const vpiConstantVariable: u32 = 612; -pub const vpiStructUnionMember: u32 = 615; -pub const vpiVisibility: u32 = 620; -pub const vpiPublicVis: u32 = 1; -pub const vpiProtectedVis: u32 = 2; -pub const vpiLocalVis: u32 = 3; -pub const vpiOneStepConst: u32 = 9; -pub const vpiUnboundedConst: u32 = 10; -pub const vpiNullConst: u32 = 11; -pub const vpiAlwaysType: u32 = 624; -pub const vpiAlwaysComb: u32 = 2; -pub const vpiAlwaysFF: u32 = 3; -pub const vpiAlwaysLatch: u32 = 4; -pub const vpiDistType: u32 = 625; -pub const vpiEqualDist: u32 = 1; -pub const vpiDivDist: u32 = 2; -pub const vpiPacked: u32 = 630; -pub const vpiTagged: u32 = 632; -pub const vpiRef: u32 = 6; -pub const vpiVirtual: u32 = 635; -pub const vpiHasActual: u32 = 636; -pub const vpiIsConstraintEnabled: u32 = 638; -pub const vpiSoft: u32 = 639; -pub const vpiClassType: u32 = 640; -pub const vpiMailboxClass: u32 = 1; -pub const vpiSemaphoreClass: u32 = 2; -pub const vpiUserDefinedClass: u32 = 3; -pub const vpiProcessClass: u32 = 4; -pub const vpiMethod: u32 = 645; -pub const vpiIsClockInferred: u32 = 649; -pub const vpiIsDeferred: u32 = 657; -pub const vpiIsFinal: u32 = 670; -pub const vpiIsCoverSequence: u32 = 659; -pub const vpiQualifier: u32 = 650; -pub const vpiNoQualifier: u32 = 0; -pub const vpiUniqueQualifier: u32 = 1; -pub const vpiPriorityQualifier: u32 = 2; -pub const vpiTaggedQualifier: u32 = 4; -pub const vpiRandQualifier: u32 = 8; -pub const vpiInsideQualifier: u32 = 16; -pub const vpiInputEdge: u32 = 651; -pub const vpiOutputEdge: u32 = 652; -pub const vpiGeneric: u32 = 653; -pub const vpiCompatibilityMode: u32 = 654; -pub const vpiMode1364v1995: u32 = 1; -pub const vpiMode1364v2001: u32 = 2; -pub const vpiMode1364v2005: u32 = 3; -pub const vpiMode1800v2005: u32 = 4; -pub const vpiMode1800v2009: u32 = 5; -pub const vpiPackedArrayMember: u32 = 655; -pub const vpiStartLine: u32 = 661; -pub const vpiColumn: u32 = 662; -pub const vpiEndLine: u32 = 663; -pub const vpiEndColumn: u32 = 664; -pub const vpiAllocScheme: u32 = 658; -pub const vpiAutomaticScheme: u32 = 1; -pub const vpiDynamicScheme: u32 = 2; -pub const vpiOtherScheme: u32 = 3; -pub const vpiObjId: u32 = 660; -pub const vpiDPIPure: u32 = 665; -pub const vpiDPIContext: u32 = 666; -pub const vpiDPICStr: u32 = 667; -pub const vpiDPI: u32 = 1; -pub const vpiDPIC: u32 = 2; -pub const vpiDPICIdentifier: u32 = 668; -pub const vpiIsModPort: u32 = 669; -pub const vpiImplyOp: u32 = 50; -pub const vpiNonOverlapImplyOp: u32 = 51; -pub const vpiOverlapImplyOp: u32 = 52; -pub const vpiAcceptOnOp: u32 = 83; -pub const vpiRejectOnOp: u32 = 84; -pub const vpiSyncAcceptOnOp: u32 = 85; -pub const vpiSyncRejectOnOp: u32 = 86; -pub const vpiOverlapFollowedByOp: u32 = 87; -pub const vpiNonOverlapFollowedByOp: u32 = 88; -pub const vpiNexttimeOp: u32 = 89; -pub const vpiAlwaysOp: u32 = 90; -pub const vpiEventuallyOp: u32 = 91; -pub const vpiUntilOp: u32 = 92; -pub const vpiUntilWithOp: u32 = 93; -pub const vpiUnaryCycleDelayOp: u32 = 53; -pub const vpiCycleDelayOp: u32 = 54; -pub const vpiIntersectOp: u32 = 55; -pub const vpiFirstMatchOp: u32 = 56; -pub const vpiThroughoutOp: u32 = 57; -pub const vpiWithinOp: u32 = 58; -pub const vpiRepeatOp: u32 = 59; -pub const vpiConsecutiveRepeatOp: u32 = 60; -pub const vpiGotoRepeatOp: u32 = 61; -pub const vpiPostIncOp: u32 = 62; -pub const vpiPreIncOp: u32 = 63; -pub const vpiPostDecOp: u32 = 64; -pub const vpiPreDecOp: u32 = 65; -pub const vpiMatchOp: u32 = 66; -pub const vpiCastOp: u32 = 67; -pub const vpiIffOp: u32 = 68; -pub const vpiWildEqOp: u32 = 69; -pub const vpiWildNeqOp: u32 = 70; -pub const vpiStreamLROp: u32 = 71; -pub const vpiStreamRLOp: u32 = 72; -pub const vpiMatchedOp: u32 = 73; -pub const vpiTriggeredOp: u32 = 74; -pub const vpiAssignmentPatternOp: u32 = 75; -pub const vpiMultiAssignmentPatternOp: u32 = 76; -pub const vpiIfOp: u32 = 77; -pub const vpiIfElseOp: u32 = 78; -pub const vpiCompAndOp: u32 = 79; -pub const vpiCompOrOp: u32 = 80; -pub const vpiImpliesOp: u32 = 94; -pub const vpiInsideOp: u32 = 95; -pub const vpiTypeOp: u32 = 81; -pub const vpiAssignmentOp: u32 = 82; -pub const vpiOtherFunc: u32 = 6; -pub const vpiValidUnknown: u32 = 2; -pub const vpiCoverageStart: u32 = 750; -pub const vpiCoverageStop: u32 = 751; -pub const vpiCoverageReset: u32 = 752; -pub const vpiCoverageCheck: u32 = 753; -pub const vpiCoverageMerge: u32 = 754; -pub const vpiCoverageSave: u32 = 755; -pub const vpiAssertCoverage: u32 = 760; -pub const vpiFsmStateCoverage: u32 = 761; -pub const vpiStatementCoverage: u32 = 762; -pub const vpiToggleCoverage: u32 = 763; -pub const vpiCovered: u32 = 765; -pub const vpiCoverMax: u32 = 766; -pub const vpiCoveredMax: u32 = 766; -pub const vpiCoveredCount: u32 = 767; -pub const vpiAssertAttemptCovered: u32 = 770; -pub const vpiAssertSuccessCovered: u32 = 771; -pub const vpiAssertFailureCovered: u32 = 772; -pub const vpiAssertVacuousSuccessCovered: u32 = 773; -pub const vpiAssertDisableCovered: u32 = 774; -pub const vpiAssertKillCovered: u32 = 777; -pub const vpiFsmStates: u32 = 775; -pub const vpiFsmStateExpression: u32 = 776; -pub const vpiFsm: u32 = 758; -pub const vpiFsmHandle: u32 = 759; -pub const vpiAssertionLock: u32 = 645; -pub const vpiAssertionUnlock: u32 = 646; -pub const vpiAssertionDisable: u32 = 620; -pub const vpiAssertionEnable: u32 = 621; -pub const vpiAssertionReset: u32 = 622; -pub const vpiAssertionKill: u32 = 623; -pub const vpiAssertionEnableStep: u32 = 624; -pub const vpiAssertionDisableStep: u32 = 625; -pub const vpiAssertionClockSteps: u32 = 626; -pub const vpiAssertionSysLock: u32 = 647; -pub const vpiAssertionSysUnlock: u32 = 648; -pub const vpiAssertionSysOn: u32 = 627; -pub const vpiAssertionSysOff: u32 = 628; -pub const vpiAssertionSysKill: u32 = 632; -pub const vpiAssertionSysEnd: u32 = 629; -pub const vpiAssertionSysReset: u32 = 630; -pub const vpiAssertionDisablePassAction: u32 = 633; -pub const vpiAssertionEnablePassAction: u32 = 634; -pub const vpiAssertionDisableFailAction: u32 = 635; -pub const vpiAssertionEnableFailAction: u32 = 636; -pub const vpiAssertionDisableVacuousAction: u32 = 637; -pub const vpiAssertionEnableNonvacuousAction: u32 = 638; -pub const vpiAssertionSysEnablePassAction: u32 = 639; -pub const vpiAssertionSysEnableFailAction: u32 = 640; -pub const vpiAssertionSysDisablePassAction: u32 = 641; -pub const vpiAssertionSysDisableFailAction: u32 = 642; -pub const vpiAssertionSysEnableNonvacuousAction: u32 = 643; -pub const vpiAssertionSysDisableVacuousAction: u32 = 644; -pub type va_list = __builtin_va_list; -pub type PLI_INT64 = i64; -pub type PLI_INT32 = ::std::os::raw::c_int; -pub type PLI_UINT32 = ::std::os::raw::c_uint; -pub type PLI_INT16 = ::std::os::raw::c_short; -pub type PLI_BYTE8 = ::std::os::raw::c_char; -#[doc = " TYPEDEFS"] -pub type vpiHandle = *mut PLI_UINT32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_time { - pub type_: PLI_INT32, - pub high: PLI_UINT32, - pub low: PLI_UINT32, - pub real: f64, -} -#[test] -fn bindgen_test_layout_t_vpi_time() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(t_vpi_time)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_time)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).high) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(high) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).low) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(low) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).real) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_time), - "::", - stringify!(real) - ) - ); -} -pub type s_vpi_time = t_vpi_time; -pub type p_vpi_time = *mut t_vpi_time; -#[doc = " delay structures"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_delay { - pub da: *mut t_vpi_time, - pub no_of_delays: PLI_INT32, - pub time_type: PLI_INT32, - pub mtm_flag: PLI_INT32, - pub append_flag: PLI_INT32, - pub pulsere_flag: PLI_INT32, -} -#[test] -fn bindgen_test_layout_t_vpi_delay() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(t_vpi_delay)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_delay)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).da) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(da) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).no_of_delays) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(no_of_delays) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).time_type) as usize - ptr as usize }, - 12usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(time_type) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).mtm_flag) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(mtm_flag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).append_flag) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(append_flag) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).pulsere_flag) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_delay), - "::", - stringify!(pulsere_flag) - ) - ); -} -#[doc = " delay structures"] -pub type p_vpi_delay = *mut t_vpi_delay; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_vecval { - pub aval: PLI_UINT32, - pub bval: PLI_UINT32, -} -#[test] -fn bindgen_test_layout_t_vpi_vecval() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(t_vpi_vecval)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(t_vpi_vecval)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).aval) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vecval), - "::", - stringify!(aval) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).bval) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vecval), - "::", - stringify!(bval) - ) - ); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_strengthval { - pub logic: PLI_INT32, - pub s0: PLI_INT32, - pub s1: PLI_INT32, -} -#[test] -fn bindgen_test_layout_t_vpi_strengthval() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 12usize, - concat!("Size of: ", stringify!(t_vpi_strengthval)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(t_vpi_strengthval)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).logic) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_strengthval), - "::", - stringify!(logic) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).s0) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_strengthval), - "::", - stringify!(s0) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).s1) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_strengthval), - "::", - stringify!(s1) - ) - ); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct t_vpi_value { - pub format: PLI_INT32, - pub value: t_vpi_value__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union t_vpi_value__bindgen_ty_1 { - pub str_: *mut PLI_BYTE8, - pub scalar: PLI_INT32, - pub integer: PLI_INT32, - pub real: f64, - pub time: *mut t_vpi_time, - pub vector: *mut t_vpi_vecval, - pub strength: *mut t_vpi_strengthval, - pub misc: *mut PLI_BYTE8, -} -#[test] -fn bindgen_test_layout_t_vpi_value__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(t_vpi_value__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_value__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).str_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(str_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).scalar) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(scalar) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).integer) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(integer) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).real) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(real) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).time) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(time) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).vector) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(vector) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).strength) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(strength) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).misc) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value__bindgen_ty_1), - "::", - stringify!(misc) - ) - ); -} -#[test] -fn bindgen_test_layout_t_vpi_value() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(t_vpi_value)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_value)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value), - "::", - stringify!(format) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_value), - "::", - stringify!(value) - ) - ); -} -pub type p_vpi_value = *mut t_vpi_value; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct t_vpi_arrayvalue { - pub format: PLI_UINT32, - pub flags: PLI_UINT32, - pub value: t_vpi_arrayvalue__bindgen_ty_1, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union t_vpi_arrayvalue__bindgen_ty_1 { - pub integers: *mut PLI_INT32, - pub shortints: *mut PLI_INT16, - pub longints: *mut PLI_INT64, - pub rawvals: *mut PLI_BYTE8, - pub vectors: *mut t_vpi_vecval, - pub times: *mut t_vpi_time, - pub reals: *mut f64, - pub shortreals: *mut f32, -} -#[test] -fn bindgen_test_layout_t_vpi_arrayvalue__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(t_vpi_arrayvalue__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_arrayvalue__bindgen_ty_1)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).integers) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(integers) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).shortints) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(shortints) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).longints) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(longints) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).rawvals) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(rawvals) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).vectors) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(vectors) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).times) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(times) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reals) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(reals) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).shortreals) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue__bindgen_ty_1), - "::", - stringify!(shortreals) - ) - ); -} -#[test] -fn bindgen_test_layout_t_vpi_arrayvalue() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(t_vpi_arrayvalue)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_arrayvalue)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue), - "::", - stringify!(format) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue), - "::", - stringify!(flags) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_arrayvalue), - "::", - stringify!(value) - ) - ); -} -pub type p_vpi_arrayvalue = *mut t_vpi_arrayvalue; -#[doc = " system task/function structure"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_systf_data { - pub type_: PLI_INT32, - pub sysfunctype: PLI_INT32, - pub tfname: *mut PLI_BYTE8, - pub calltf: ::std::option::Option PLI_INT32>, - pub compiletf: ::std::option::Option PLI_INT32>, - pub sizetf: ::std::option::Option PLI_INT32>, - pub user_data: *mut PLI_BYTE8, -} -#[test] -fn bindgen_test_layout_t_vpi_systf_data() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(t_vpi_systf_data)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_systf_data)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(type_) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sysfunctype) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(sysfunctype) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tfname) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(tfname) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).calltf) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(calltf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).compiletf) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(compiletf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).sizetf) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(sizetf) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).user_data) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_systf_data), - "::", - stringify!(user_data) - ) - ); -} -#[doc = " system task/function structure"] -pub type p_vpi_systf_data = *mut t_vpi_systf_data; -#[doc = " SystemVerilog execution information structure"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_vlog_info { - pub argc: PLI_INT32, - pub argv: *mut *mut PLI_BYTE8, - pub product: *mut PLI_BYTE8, - pub version: *mut PLI_BYTE8, -} -#[test] -fn bindgen_test_layout_t_vpi_vlog_info() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(t_vpi_vlog_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_vlog_info)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).argc) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vlog_info), - "::", - stringify!(argc) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).argv) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vlog_info), - "::", - stringify!(argv) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).product) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vlog_info), - "::", - stringify!(product) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_vlog_info), - "::", - stringify!(version) - ) - ); -} -#[doc = " SystemVerilog execution information structure"] -pub type p_vpi_vlog_info = *mut t_vpi_vlog_info; -#[doc = " PLI error information structure"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_error_info { - pub state: PLI_INT32, - pub level: PLI_INT32, - pub message: *mut PLI_BYTE8, - pub product: *mut PLI_BYTE8, - pub code: *mut PLI_BYTE8, - pub file: *mut PLI_BYTE8, - pub line: PLI_INT32, -} -#[test] -fn bindgen_test_layout_t_vpi_error_info() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(t_vpi_error_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_error_info)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).state) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(state) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).level) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(level) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).message) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(message) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).product) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(product) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).code) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(code) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).file) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(file) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).line) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_error_info), - "::", - stringify!(line) - ) - ); -} -#[doc = " PLI error information structure"] -pub type p_vpi_error_info = *mut t_vpi_error_info; -#[doc = " callback structures"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_cb_data { - pub reason: PLI_INT32, - pub cb_rtn: ::std::option::Option PLI_INT32>, - pub obj: vpiHandle, - pub time: p_vpi_time, - pub value: p_vpi_value, - pub index: PLI_INT32, - pub user_data: *mut PLI_BYTE8, -} -#[test] -fn bindgen_test_layout_t_cb_data() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(t_cb_data)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_cb_data)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reason) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(reason) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).cb_rtn) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(cb_rtn) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).obj) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(obj) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).time) as usize - ptr as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(time) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(value) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).index) as usize - ptr as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(index) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).user_data) as usize - ptr as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(t_cb_data), - "::", - stringify!(user_data) - ) - ); -} -#[doc = " callback structures"] -pub type p_cb_data = *mut t_cb_data; -extern "C" { - pub fn vpi_register_cb(cb_data_p: p_cb_data) -> vpiHandle; -} -extern "C" { - pub fn vpi_remove_cb(cb_obj: vpiHandle) -> PLI_INT32; -} -extern "C" { - pub fn vpi_get_cb_info(object: vpiHandle, cb_data_p: p_cb_data); -} -extern "C" { - pub fn vpi_register_systf(systf_data_p: p_vpi_systf_data) -> vpiHandle; -} -extern "C" { - pub fn vpi_get_systf_info(object: vpiHandle, systf_data_p: p_vpi_systf_data); -} -extern "C" { - pub fn vpi_handle_by_name(name: *mut PLI_BYTE8, scope: vpiHandle) -> vpiHandle; -} -extern "C" { - pub fn vpi_handle_by_index(object: vpiHandle, indx: PLI_INT32) -> vpiHandle; -} -extern "C" { - pub fn vpi_handle(type_: PLI_INT32, refHandle: vpiHandle) -> vpiHandle; -} -extern "C" { - pub fn vpi_handle_multi( - type_: PLI_INT32, - refHandle1: vpiHandle, - refHandle2: vpiHandle, - ... - ) -> vpiHandle; -} -extern "C" { - pub fn vpi_iterate(type_: PLI_INT32, refHandle: vpiHandle) -> vpiHandle; -} -extern "C" { - pub fn vpi_scan(iterator: vpiHandle) -> vpiHandle; -} -extern "C" { - pub fn vpi_get(property: PLI_INT32, object: vpiHandle) -> PLI_INT32; -} -extern "C" { - pub fn vpi_get64(property: PLI_INT32, object: vpiHandle) -> PLI_INT64; -} -extern "C" { - pub fn vpi_get_str(property: PLI_INT32, object: vpiHandle) -> *mut PLI_BYTE8; -} -extern "C" { - pub fn vpi_get_delays(object: vpiHandle, delay_p: p_vpi_delay); -} -extern "C" { - pub fn vpi_put_delays(object: vpiHandle, delay_p: p_vpi_delay); -} -extern "C" { - pub fn vpi_get_value(expr: vpiHandle, value_p: p_vpi_value); -} -extern "C" { - pub fn vpi_put_value( - object: vpiHandle, - value_p: p_vpi_value, - time_p: p_vpi_time, - flags: PLI_INT32, - ) -> vpiHandle; -} -extern "C" { - pub fn vpi_get_value_array( - object: vpiHandle, - arrayvalue_p: p_vpi_arrayvalue, - index_p: *mut PLI_INT32, - num: PLI_UINT32, - ); -} -extern "C" { - pub fn vpi_put_value_array( - object: vpiHandle, - arrayvalue_p: p_vpi_arrayvalue, - index_p: *mut PLI_INT32, - num: PLI_UINT32, - ); -} -extern "C" { - pub fn vpi_get_time(object: vpiHandle, time_p: p_vpi_time); -} -extern "C" { - pub fn vpi_mcd_open(fileName: *mut PLI_BYTE8) -> PLI_UINT32; -} -extern "C" { - pub fn vpi_mcd_close(mcd: PLI_UINT32) -> PLI_UINT32; -} -extern "C" { - pub fn vpi_mcd_name(cd: PLI_UINT32) -> *mut PLI_BYTE8; -} -extern "C" { - pub fn vpi_mcd_printf(mcd: PLI_UINT32, format: *mut PLI_BYTE8, ...) -> PLI_INT32; -} -extern "C" { - pub fn vpi_printf(format: *mut PLI_BYTE8, ...) -> PLI_INT32; -} -extern "C" { - pub fn vpi_compare_objects(object1: vpiHandle, object2: vpiHandle) -> PLI_INT32; -} -extern "C" { - pub fn vpi_chk_error(error_info_p: p_vpi_error_info) -> PLI_INT32; -} -extern "C" { - pub fn vpi_free_object(object: vpiHandle) -> PLI_INT32; -} -extern "C" { - pub fn vpi_release_handle(object: vpiHandle) -> PLI_INT32; -} -extern "C" { - pub fn vpi_get_vlog_info(vlog_info_p: p_vpi_vlog_info) -> PLI_INT32; -} -extern "C" { - pub fn vpi_get_data(id: PLI_INT32, dataLoc: *mut PLI_BYTE8, numOfBytes: PLI_INT32) - -> PLI_INT32; -} -extern "C" { - pub fn vpi_put_data(id: PLI_INT32, dataLoc: *mut PLI_BYTE8, numOfBytes: PLI_INT32) - -> PLI_INT32; -} -extern "C" { - pub fn vpi_get_userdata(obj: vpiHandle) -> *mut ::std::os::raw::c_void; -} -extern "C" { - pub fn vpi_put_userdata(obj: vpiHandle, userdata: *mut ::std::os::raw::c_void) -> PLI_INT32; -} -extern "C" { - pub fn vpi_vprintf(format: *mut PLI_BYTE8, ap: *mut __va_list_tag) -> PLI_INT32; -} -extern "C" { - pub fn vpi_mcd_vprintf( - mcd: PLI_UINT32, - format: *mut PLI_BYTE8, - ap: *mut __va_list_tag, - ) -> PLI_INT32; -} -extern "C" { - pub fn vpi_flush() -> PLI_INT32; -} -extern "C" { - pub fn vpi_mcd_flush(mcd: PLI_UINT32) -> PLI_INT32; -} -extern "C" { - pub fn vpi_control(operation: PLI_INT32, ...) -> PLI_INT32; -} -extern "C" { - pub fn vpi_handle_by_multi_index( - obj: vpiHandle, - num_index: PLI_INT32, - index_array: *mut PLI_INT32, - ) -> vpiHandle; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct t_vpi_assertion_step_info { - pub matched_expression_count: PLI_INT32, - pub matched_exprs: *mut vpiHandle, - pub stateFrom: PLI_INT32, - pub stateTo: PLI_INT32, -} -#[test] -fn bindgen_test_layout_t_vpi_assertion_step_info() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(t_vpi_assertion_step_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_assertion_step_info)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).matched_expression_count) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_assertion_step_info), - "::", - stringify!(matched_expression_count) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).matched_exprs) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_assertion_step_info), - "::", - stringify!(matched_exprs) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stateFrom) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_assertion_step_info), - "::", - stringify!(stateFrom) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).stateTo) as usize - ptr as usize }, - 20usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_assertion_step_info), - "::", - stringify!(stateTo) - ) - ); -} -pub type p_vpi_assertion_step_info = *mut t_vpi_assertion_step_info; -#[repr(C)] -#[derive(Copy, Clone)] -pub struct t_vpi_attempt_info { - pub detail: t_vpi_attempt_info__bindgen_ty_1, - pub attemptStartTime: s_vpi_time, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union t_vpi_attempt_info__bindgen_ty_1 { - pub failExpr: vpiHandle, - pub step: p_vpi_assertion_step_info, -} -#[test] -fn bindgen_test_layout_t_vpi_attempt_info__bindgen_ty_1() { - const UNINIT: ::std::mem::MaybeUninit = - ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(t_vpi_attempt_info__bindgen_ty_1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(t_vpi_attempt_info__bindgen_ty_1) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).failExpr) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_attempt_info__bindgen_ty_1), - "::", - stringify!(failExpr) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).step) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_attempt_info__bindgen_ty_1), - "::", - stringify!(step) - ) - ); -} -#[test] -fn bindgen_test_layout_t_vpi_attempt_info() { - const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(t_vpi_attempt_info)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(t_vpi_attempt_info)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).detail) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_attempt_info), - "::", - stringify!(detail) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).attemptStartTime) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(t_vpi_attempt_info), - "::", - stringify!(attemptStartTime) - ) - ); -} -pub type p_vpi_attempt_info = *mut t_vpi_attempt_info; -pub type vpi_assertion_callback_func = ::std::option::Option< - unsafe extern "C" fn( - reason: PLI_INT32, - cb_time: p_vpi_time, - assertion: vpiHandle, - info: p_vpi_attempt_info, - user_data: *mut PLI_BYTE8, - ) -> PLI_INT32, ->; -extern "C" { - pub fn vpi_register_assertion_cb( - assertion: vpiHandle, - reason: PLI_INT32, - cb_rtn: vpi_assertion_callback_func, - user_data: *mut PLI_BYTE8, - ) -> vpiHandle; -} -pub type __builtin_va_list = [__va_list_tag; 1usize]; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct __va_list_tag { - pub gp_offset: ::std::os::raw::c_uint, - pub fp_offset: ::std::os::raw::c_uint, - pub overflow_arg_area: *mut ::std::os::raw::c_void, - pub reg_save_area: *mut ::std::os::raw::c_void, -} -#[test] -fn bindgen_test_layout___va_list_tag() { - const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); - let ptr = UNINIT.as_ptr(); - assert_eq!( - ::std::mem::size_of::<__va_list_tag>(), - 24usize, - concat!("Size of: ", stringify!(__va_list_tag)) - ); - assert_eq!( - ::std::mem::align_of::<__va_list_tag>(), - 8usize, - concat!("Alignment of ", stringify!(__va_list_tag)) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(gp_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, - 4usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(fp_offset) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(overflow_arg_area) - ) - ); - assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(__va_list_tag), - "::", - stringify!(reg_save_area) - ) - ); -} diff --git a/t1rocketemu/online_drive/Cargo.toml b/t1rocketemu/online_drive/Cargo.toml deleted file mode 100644 index 929a8b546..000000000 --- a/t1rocketemu/online_drive/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "online_drive" -version = "0.1.0" -edition = "2021" - -[dependencies] -online_dpi = { path = "../online_dpi", features = ["sv2023"] } - -[build-dependencies] -cmake = "0.1.50" - -[features] -trace = ["online_dpi/trace"] diff --git a/t1rocketemu/online_drive/build.rs b/t1rocketemu/online_drive/build.rs deleted file mode 100644 index d08bd0aa5..000000000 --- a/t1rocketemu/online_drive/build.rs +++ /dev/null @@ -1,24 +0,0 @@ -use cmake::Config; - -fn main() { - #[cfg(feature = "trace")] - let dst = Config::new("verilator_shim") - .define("VM_TRACE", "1") - .very_verbose(true) - .always_configure(true) - .build(); - #[cfg(not(feature = "trace"))] - let dst = Config::new("verilator_shim").very_verbose(true).always_configure(true).build(); - - println!("cargo::rustc-link-search=native={}/lib", dst.display()); - - // link order matters! so we use +whole-archive here - // verilator_main <- VTestBench <-- verilated <- verilator_shim <- stdc++ - // verilated <- libz - println!("cargo::rustc-link-lib=static:+whole-archive=verilator_shim"); - println!("cargo::rustc-link-lib=static:+whole-archive=VTestBench"); - println!("cargo::rustc-link-lib=static:+whole-archive=verilated"); - println!("cargo::rustc-link-lib=stdc++"); - println!("cargo::rustc-link-lib=z"); - println!("cargo::rerun-if-env-changed=VERILATED_LIB_DIR"); -} diff --git a/t1rocketemu/online_drive/src/main.rs b/t1rocketemu/online_drive/src/main.rs deleted file mode 100644 index 92f63e02b..000000000 --- a/t1rocketemu/online_drive/src/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -// force link with online_dpi -extern crate online_dpi; - -use std::{ - ffi::{c_char, c_int, CString}, - ptr, -}; - -fn main() { - let c_args: Vec = std::env::args().map(|arg| CString::new(arg).unwrap()).collect(); - - let mut c_args_ptr: Vec<*const c_char> = c_args.iter().map(|arg| arg.as_ptr()).collect(); - c_args_ptr.push(ptr::null()); - - let argc = c_args.len() as c_int; - let argv = c_args_ptr.as_ptr() as *mut *mut c_char; - - let verilator_ret = unsafe { verilator_main_c(argc, argv) }; - - if verilator_ret == 0 { - std::fs::write("perf.txt", format!("total_cycles: {}", online_dpi::get_t())) - .expect("fail to write into perf.txt"); - } else { - eprintln!("verilator_main_c return unexpectedly"); - } - - std::process::exit(verilator_ret); -} - -extern "C" { - fn verilator_main_c(argc: c_int, argv: *mut *mut c_char) -> c_int; -} diff --git a/t1rocketemu/online_drive/verilator_shim/CMakeLists.txt b/t1rocketemu/online_drive/verilator_shim/CMakeLists.txt deleted file mode 100644 index e7aefb74f..000000000 --- a/t1rocketemu/online_drive/verilator_shim/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -cmake_minimum_required(VERSION 3.20) -project(verilator_shim) -set(CMAKE_CXX_STANDARD 17) - -message(STATUS "Project '${PROJECT_NAME}' build type: ${CMAKE_BUILD_TYPE}") - -set(THREADS_PREFER_PTHREAD_FLAG ON) - -add_library(verilator_shim - STATIC - verilator_shim.cc -) - -if (NOT DEFINED VERILATED_LIB_DIR) - set(VERILATED_LIB_DIR "$ENV{VERILATED_LIB_DIR}") - if (VERILATED_LIB_DIR STREQUAL "") - message(FATAL_ERROR "You should specify verilated libs via -DVERILATE_LIB_DIR or environment variable VERILATED_LIB_DIR, but it seems not") - endif() -endif() - -if (NOT DEFINED VERILATED_INC_DIR) - set(VERILATED_INC_DIR "$ENV{VERILATED_INC_DIR}") - if (VERILATED_INC_DIR STREQUAL "") - message(FATAL_ERROR "You should specify verilated libs via -DVERILATED_INC_DIR or environment variable VERILATED_INC_DIR, but it seems not") - endif() -endif() - -# include verilator headers -find_package(verilator REQUIRED) -message(STATUS "Found verilator: ${verilator_DIR}") -target_include_directories(verilator_shim PUBLIC ${verilator_DIR}/include) -target_include_directories(verilator_shim PUBLIC ${verilator_DIR}/include/vltstd) - -if(DEFINED VM_TRACE) - target_compile_definitions(verilator_shim PRIVATE VM_TRACE=1) -endif() - -install(TARGETS verilator_shim ARCHIVE) diff --git a/t1rocketemu/online_drive/verilator_shim/verilator_shim.cc b/t1rocketemu/online_drive/verilator_shim/verilator_shim.cc deleted file mode 100644 index 47c81f758..000000000 --- a/t1rocketemu/online_drive/verilator_shim/verilator_shim.cc +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include - -class VTestBench; - -extern "C" int verilator_main_c(int argc, char **argv) { - // Setup context, defaults, and parse command line - Verilated::debug(0); - - // use unique_ptr to ensure deletion of context and model - std::unique_ptr contextp; - std::unique_ptr topp; - - // Construct the Verilated context - contextp = std::make_unique(); - // Construct the Verilated model, from Vtop.h generated from Verilating - topp = std::make_unique(contextp.get()); - - contextp->fatalOnError(false); - contextp->commandArgs(argc, argv); -#ifdef VM_TRACE - contextp->traceEverOn(true); -#endif - - // Simulate until $finish - while (!contextp->gotFinish()) { - // Evaluate model - topp->eval(); - // Advance time - if (!topp->eventsPending()) - break; - contextp->time(topp->nextTimeSlot()); - } - - if (!contextp->gotFinish()) { - VL_DEBUG_IF(VL_PRINTF("+ Exiting without $finish; no events left\n");); - return 1; - } - - if (contextp->gotError()) { - VL_DEBUG_IF(VL_PRINTF("+ Exiting due to errors\n");); - return 1; - } - - // Final model cleanup - topp->final(); - - return 0; -} diff --git a/t1rocketemu/online_vcs/Cargo.toml b/t1rocketemu/online_vcs/Cargo.toml deleted file mode 100644 index d85b2b690..000000000 --- a/t1rocketemu/online_vcs/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "online_vcs" -edition = "2021" -version.workspace = true - -[lib] -crate-type = ["staticlib"] -name = "dpi" - -[dependencies] -online_dpi = { path = "../online_dpi", features = ["svvpi"] } - -[features] -trace = ["online_dpi/trace"] diff --git a/t1rocketemu/online_vcs/src/lib.rs b/t1rocketemu/online_vcs/src/lib.rs deleted file mode 100644 index be27f2116..000000000 --- a/t1rocketemu/online_vcs/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -// force link with online_dpi -extern crate online_dpi;