hdl.rec: separate record and signal name with __, not _.

This makes names of signals within records less ambiguous, in case
they themselves have underscores within them.
This commit is contained in:
anuejn 2019-03-25 15:26:00 +01:00 committed by whitequark
parent 81ee2db163
commit 3c95299c4e
2 changed files with 4 additions and 4 deletions

View file

@ -72,7 +72,7 @@ class Record(Value):
def concat(a, b): def concat(a, b):
if a is None: if a is None:
return b return b
return "{}_{}".format(a, b) return "{}__{}".format(a, b)
self.layout = Layout.wrap(layout) self.layout = Layout.wrap(layout)
self.fields = OrderedDict() self.fields = OrderedDict()

View file

@ -65,11 +65,11 @@ class RecordTestCase(FHDLTestCase):
]) ])
]) ])
self.assertEqual(repr(r), "(rec r stb data (rec r_info a b))") self.assertEqual(repr(r), "(rec r stb data (rec r__info a b))")
self.assertEqual(len(r), 35) self.assertEqual(len(r), 35)
self.assertIsInstance(r.stb, Signal) self.assertIsInstance(r.stb, Signal)
self.assertEqual(r.stb.name, "r_stb") self.assertEqual(r.stb.name, "r__stb")
self.assertEqual(r["stb"].name, "r_stb") self.assertEqual(r["stb"].name, "r__stb")
def test_unnamed(self): def test_unnamed(self):
r = [Record([ r = [Record([