Skip to content

Commit de69630

Browse files
committed
[ot] python/qemu: ot.top: add a new module to manage OT tops.
For now, only enumerate supported top names. Signed-off-by: Emmanuel Blot <[email protected]>
1 parent 293b9ab commit de69630

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

python/qemu/ot/top/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2025 2025 lowRISC contributors.
2+
# SPDX-License-Identifier: Apache2
3+
4+
"""OpenTitan Tops."""
5+
6+
from ot.util.misc import classproperty
7+
from typing import Optional
8+
9+
10+
class OpenTitanTop:
11+
"""OpenTitan supported tops."""
12+
13+
SHORT_MAP = {
14+
'darjeeling': 'dj',
15+
'earlgrey': 'eg',
16+
}
17+
18+
@classproperty
19+
def names(cls) -> list[str]:
20+
"""Supported top names."""
21+
# pylint: disable=no-self-argument
22+
return list(cls.SHORT_MAP)
23+
24+
@classmethod
25+
def short_name(cls, topname: str) -> Optional[str]:
26+
"""Get the short form of a top."""
27+
return cls.SHORT_MAP.get(topname.lower())

0 commit comments

Comments
 (0)