// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef __OTBN_MEMUTIL_SVH__
`define __OTBN_MEMUTIL_SVH__

// Imports for the functions defined in otbn_memutil.h. There are documentation comments explaining
// what the functions do there.

import "DPI-C" function chandle OtbnMemUtilMake(string top_scope);

import "DPI-C" function void OtbnMemUtilFree(chandle mem_util);

import "DPI-C" function bit OtbnMemUtilLoadElf(chandle mem_util, string elf_path);

import "DPI-C" function bit OtbnMemUtilStageElf(chandle mem_util, string elf_path);

import "DPI-C" function int OtbnMemUtilGetSegCount(chandle mem_util, bit is_imem);

import "DPI-C" function bit OtbnMemUtilGetSegInfo(chandle mem_util, bit is_imem, int seg_idx,
                                                  output bit [31:0] seg_off,
                                                  output bit [31:0] seg_size);

import "DPI-C" function bit OtbnMemUtilGetSegData(chandle mem_util, bit is_imem, int word_off,
                                                  output bit[31:0] data_value);


`endif // __OTBN_MEMUTIL_SVH__

// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

`ifndef __OTBN_MEMUTIL_SVH__
`define __OTBN_MEMUTIL_SVH__

// Imports for the functions defined in otbn_memutil.h. There are documentation comments explaining
// what the functions do there.

import "DPI-C" function chandle OtbnMemUtilMake(string top_scope);

import "DPI-C" function void OtbnMemUtilFree(chandle mem_util);

import "DPI-C" context function bit OtbnMemUtilLoadElf(chandle mem_util, string elf_path);

import "DPI-C" function bit OtbnMemUtilStageElf(chandle mem_util, string elf_path);

import "DPI-C" function int OtbnMemUtilGetSegCount(chandle mem_util, bit is_imem);

import "DPI-C" function bit OtbnMemUtilGetSegInfo(chandle mem_util, bit is_imem, int seg_idx,
                                                  output bit [31:0] seg_off,
                                                  output bit [31:0] seg_size);

import "DPI-C" function bit OtbnMemUtilGetSegData(chandle mem_util, bit is_imem, int word_off,
                                                  output bit[31:0] data_value);


`endif // __OTBN_MEMUTIL_SVH__

[otbn] Add missing context keyword to DPI declaration

OtbnMemUtilLoadElf uses svSetScope to do back-door DPI accesses, which
isn't allowed unless the DPI declaration is marked "context" (and VCS
complains!)

Signed-off-by: Rupert Swarbrick <290093e2ad2515ed2f14d749293c8cf8e02ca274@lowrisc.org>
