From f351ede52f14651bb9fc8a949cc10df9cac3ae6b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 2 Aug 2023 15:29:28 +0100 Subject: [PATCH] number and board_shape properties --- spinn_machine/version/abstract_version.py | 16 ++++++++++++++++ spinn_machine/version/version_3.py | 10 ++++++++++ spinn_machine/version/version_5.py | 10 ++++++++++ unittests/version/test_version3.py | 2 ++ unittests/version/test_version5.py | 2 ++ 5 files changed, 40 insertions(+) diff --git a/spinn_machine/version/abstract_version.py b/spinn_machine/version/abstract_version.py index 54937916..7d636743 100644 --- a/spinn_machine/version/abstract_version.py +++ b/spinn_machine/version/abstract_version.py @@ -101,6 +101,22 @@ def name(self): :rtype: str """ + @abstractproperty + def number(self): + """ + The version number that produced this Version + + :rtype: int + """ + + @abstractproperty + def board_shape(self): + """ + The width and heigth of a single board of this type + + :return: + """ + @property def max_cores_per_chip(self): """ diff --git a/spinn_machine/version/version_3.py b/spinn_machine/version/version_3.py index 6f8440cd..85db2095 100644 --- a/spinn_machine/version/version_3.py +++ b/spinn_machine/version/version_3.py @@ -34,6 +34,16 @@ class Version3(VersionSpin1): def name(self): return "Spin1 4 Chip" + @property + @overrides(VersionSpin1.number) + def number(self): + return 3 + + @property + @overrides(VersionSpin1.board_shape) + def board_shape(self): + return (2, 2) + @property @overrides(VersionSpin1.chip_core_map) def chip_core_map(self): diff --git a/spinn_machine/version/version_5.py b/spinn_machine/version/version_5.py index c3e68271..a64ae5f7 100644 --- a/spinn_machine/version/version_5.py +++ b/spinn_machine/version/version_5.py @@ -47,6 +47,16 @@ class Version5(VersionSpin1): def name(self): return "Spin1 48 Chip" + @property + @overrides(VersionSpin1.number) + def number(self): + return 5 + + @property + @overrides(VersionSpin1.board_shape) + def board_shape(self): + return (8, 8) + @property @overrides(VersionSpin1.chip_core_map) def chip_core_map(self): diff --git a/unittests/version/test_version3.py b/unittests/version/test_version3.py index 22cf1267..4d529a1d 100644 --- a/unittests/version/test_version3.py +++ b/unittests/version/test_version3.py @@ -35,6 +35,8 @@ def test_attributes(self): self.assertEqual(123469792, version.max_sdram_per_chip) self.assertEqual(1, version.n_non_user_cores) self.assertEqual("Spin1 4 Chip", version.name) + self.assertEqual(3, version.number) + self.assertEqual((2, 2), version.board_shape) self.assertEqual(4, version.n_chips_per_board) self.assertEqual(1023, version.n_router_entries) diff --git a/unittests/version/test_version5.py b/unittests/version/test_version5.py index 72581186..f35aa164 100644 --- a/unittests/version/test_version5.py +++ b/unittests/version/test_version5.py @@ -38,6 +38,8 @@ def test_attributes(self): self.assertEqual(123469792, version.max_sdram_per_chip) self.assertEqual(1, version.n_non_user_cores) self.assertEqual("Spin1 48 Chip", version.name) + self.assertEqual(5, version.number) + self.assertEqual((8, 8), version.board_shape) self.assertEqual(48, version.n_chips_per_board) self.assertEqual(1023, version.n_router_entries)