Skip to content
Merged
7 changes: 4 additions & 3 deletions docs/opentitan/verilate.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ binaries as QEMU and comparing the outcome of each simulation environment.
````text
usage: verilate.py [-h] [-V VERILATOR] [-R FILE] [-M FILE] [-F FILE] [-O VMEM]
[-K] [-D TMP_DIR] [-c CFG] [-a PREFIX] [-C CYCLES] [-I]
[-k SECONDS] [-l] [-P FILE] [-w] [-x] [-v] [-d]
[--log-time]
[-k SECONDS] [-l] [-P FILE] [-w] [-x] [-v] [-d] [-G]
[ELF ...]

Verilator wrapper.
Expand Down Expand Up @@ -49,7 +48,7 @@ Verilator:
Extras:
-v, --verbose increase verbosity
-d, --debug enable debug mode
--log-time show local time in log messages
-G, --log-time show local time in log messages
````

### Arguments
Expand Down Expand Up @@ -79,6 +78,8 @@ Extras:
simulated platform supports multiple embedded flash partitions, in which case the specified files
are loaded in partition order. See option `-I` for a list of supported devices.

* `-G` / `--log-time` show local time before each logged message

* `-K` / `--keep-tmp` do not automatically remove temporary files and directories on exit. The user
is in charge of discarding any generated files and directories after execution. The paths to the
generated items are emitted as warning messages.
Expand Down
14 changes: 5 additions & 9 deletions python/qemu/ot/devproxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Rivos, Inc.
# Copyright (c) 2023-2025 Rivos, Inc.
# SPDX-License-Identifier: Apache2

"""Device proxy for OpenTitan devices and peripherals
Expand All @@ -19,6 +19,8 @@
from typing import Any, Callable, Iterator, NamedTuple, Optional, Union

from .mailbox.doe import DOEHeader
from .util.mbb import MB4_FALSE, MB4_TRUE


try:
from serial import Serial, serial_for_url
Expand Down Expand Up @@ -148,12 +150,6 @@ class DeviceProxy:
:paran regcount: count of 32-bit registers in the remote device
"""

MB4_TRUE = 0x6
"""Multibit bool true value."""

MB4_FALSE = 0x9
"""Multibit bool false value."""

NO_ROLE = 0xf
"""Disabled role."""

Expand Down Expand Up @@ -643,13 +639,13 @@ def lock_address_range(self) -> bool:
"""
self._log.debug('')
self.write_word(self._role, self.REGS['ADDRESS_RANGE_REGWEN'],
self.MB4_FALSE)
MB4_FALSE)

def is_locked_address_range(self) -> bool:
"""Lock address range (base and limit registers).
"""
res = self.read_word(self._role, self.REGS['ADDRESS_RANGE_REGWEN']) \
!= self.MB4_TRUE
!= MB4_TRUE
self._log.debug('%d', res)
return res

Expand Down
7 changes: 4 additions & 3 deletions python/qemu/ot/otp/map.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Rivos, Inc.
# Copyright (c) 2023-2025 Rivos, Inc.
# SPDX-License-Identifier: Apache2

"""OTP map.
Expand All @@ -15,6 +15,7 @@
except ImportError:
hjload = None

from ot.util.mbb import MB8_FALSE, MB8_TRUE
from ot.util.misc import retrieve_git_version, round_up


Expand All @@ -32,8 +33,8 @@ class OtpMap:
}

MUBI8_BOOLEANS = {
0x96: False,
0x69: True,
MB8_FALSE: False,
MB8_TRUE: True,
0x00: None
}

Expand Down
4 changes: 2 additions & 2 deletions python/qemu/ot/util/mbb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024 Rivos, Inc.
# Copyright (c) 2024-2025 Rivos, Inc.
# SPDX-License-Identifier: Apache2

"""MultiBit Boolean values
Expand All @@ -11,5 +11,5 @@
MB4_MASK = 0xf

MB8_TRUE = 0x96
MB8_FALSE = 0x89
MB8_FALSE = 0x69
MB8_MASK = 0xff
8 changes: 4 additions & 4 deletions python/qemu/ot/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Callable
from io import BytesIO
from os.path import abspath, dirname, exists, isdir, isfile, join as joinpath
from subprocess import SubprocessError, check_output
from subprocess import DEVNULL, SubprocessError, check_output
from sys import stdout
from textwrap import dedent, indent
from typing import Any, Iterable, Optional, TextIO, Union
Expand Down Expand Up @@ -253,7 +253,7 @@ def retrieve_git_version(path: str, max_tag_dist: int = 100) \
assert cfgdir is not None
try:
descstr = check_output(['git', 'describe', '--long', '--dirty'],
text=True, cwd=cfgdir).strip()
text=True, cwd=cfgdir, stderr=DEVNULL).strip()
gmo = re.match(r'^(?P<tag>.*)-(?P<dist>\d+)-g(?P<commit>[0-9a-f]+)'
r'(?:-(?P<dirty>dirty))?$', descstr)
if not gmo:
Expand All @@ -269,9 +269,9 @@ def retrieve_git_version(path: str, max_tag_dist: int = 100) \
pass
try:
change = check_output(['git', 'status', '--porcelain'],
text=True, cwd=cfgdir).strip()
text=True, cwd=cfgdir, stderr=DEVNULL).strip()
descstr = check_output(['git', 'rev-parse', '--short', 'HEAD'],
text=True, cwd=cfgdir).strip()
text=True, cwd=cfgdir, stderr=DEVNULL).strip()
if len(change) > 1:
descstr = f'{descstr}-dirty'
return descstr
Expand Down
Loading
Loading