Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

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

3# 

4# This file is part of the tsfpga project. 

5# https://tsfpga.com 

6# https://gitlab.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9from tsfpga.vivado.build_result import BuildResult 

10 

11 

12def test_size_summary(): 

13 build_result = BuildResult(name="apa") 

14 

15 build_result.synthesis_size = dict(LUT=3, FFs=4) 

16 expected = """\ 

17Size of apa after synthesis: 

18{ 

19 "LUT": 3, 

20 "FFs": 4 

21}""" 

22 assert build_result.size_summary() == expected 

23 

24 build_result.implementation_size = dict(LUT=8, FFs=9) 

25 expected = """\ 

26Size of apa after implementation: 

27{ 

28 "LUT": 8, 

29 "FFs": 9 

30}""" 

31 assert build_result.size_summary() == expected 

32 

33 

34def test_report(): 

35 build_result = BuildResult(name="apa") 

36 

37 build_result.synthesis_size = dict(LUT=3, FFs=4) 

38 expected = """\ 

39Size of apa after synthesis: 

40{ 

41 "LUT": 3, 

42 "FFs": 4 

43}""" 

44 assert build_result.report() == expected 

45 

46 # Add a logic level distribution report 

47 build_result.logic_level_distribution = """\ 

48+-----------------+-------------+-----+----+---+----+ 

49| End Point Clock | Requirement | 0 | 1 | 2 | 3 | 

50+-----------------+-------------+-----+----+---+----+ 

51| clk_fpga_0 | 2.000ns | 491 | 12 | 1 | 11 | 

52+-----------------+-------------+-----+----+---+----+\ 

53""" 

54 expected = """\ 

55Size of apa after synthesis: 

56{ 

57 "LUT": 3, 

58 "FFs": 4 

59} 

60Logic level distribution: 

61+-----------------+-------------+-----+----+---+----+ 

62| End Point Clock | Requirement | 0 | 1 | 2 | 3 | 

63+-----------------+-------------+-----+----+---+----+ 

64| clk_fpga_0 | 2.000ns | 491 | 12 | 1 | 11 | 

65+-----------------+-------------+-----+----+---+----+\ 

66""" 

67 assert build_result.report() == expected 

68 assert build_result.maximum_logic_level == 3