Coverage for hdl_registers/constant/constant.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-07 20:51 +0000

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the hdl-registers project, an HDL register generator fast enough to run 

5# in real time. 

6# https://hdl-registers.com 

7# https://github.com/hdl-registers/hdl-registers 

8# -------------------------------------------------------------------------------------------------- 

9 

10# Standard libraries 

11from abc import ABC, abstractmethod 

12from typing import Any 

13 

14 

15class Constant(ABC): 

16 """ 

17 Meta class for all register constants (integer, boolean, ...). 

18 Lists a few properties that must be available. 

19 """ 

20 

21 name: str 

22 description: str 

23 

24 @property 

25 @abstractmethod 

26 def value(self) -> Any: 

27 """ 

28 The value of the constant. Return type depends on the subclass. 

29 """