Coverage for hdl_registers/constant.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-09-29 22:03 +0000

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

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

3# 

4# This file is part of the hdl_registers project, a HDL register generator fast enough to be run 

5# in real time. 

6# https://hdl-registers.com 

7# https://gitlab.com/tsfpga/hdl_registers 

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

9 

10 

11class Constant: 

12 def __init__(self, name, value, description=None): 

13 """ 

14 Arguments: 

15 name (str): The name of the constant. 

16 value (int): The constant value (signed). 

17 description (str): Textual description for the constant. 

18 """ 

19 self.name = name 

20 self.value = value 

21 self.description = "" if description is None else description 

22 

23 def __repr__(self): 

24 return f"""{self.__class__.__name__}(\ 

25name={self.name},\ 

26value={self.value},\ 

27description={self.description}, 

28)"""