Mercurial > lcfOS
comparison python/ppci/layout.py @ 385:d056b552d3f4
Made better use of layout
author | Windel Bouwman |
---|---|
date | Thu, 01 May 2014 14:03:12 +0200 |
parents | 173e20a47fda |
children | 2a970e7270e2 |
comparison
equal
deleted
inserted
replaced
384:94f5b719ad0b | 385:d056b552d3f4 |
---|---|
3 from . import make_num | 3 from . import make_num |
4 | 4 |
5 | 5 |
6 class Layout: | 6 class Layout: |
7 def __init__(self): | 7 def __init__(self): |
8 self.mems = [] | 8 self.memories = [] |
9 | 9 |
10 def add_memory(self, memory): | 10 def add_memory(self, memory): |
11 self.mems.append(memory) | 11 self.memories.append(memory) |
12 | 12 |
13 def __eq__(self, other): | 13 def __eq__(self, other): |
14 return self.mems == other.mems | 14 return self.memories == other.memories |
15 | 15 |
16 def __repr__(self): | 16 def __repr__(self): |
17 return str(self.mems) | 17 return str(self.memories) |
18 | 18 |
19 | 19 |
20 class Memory: | 20 class Memory: |
21 """ Specification of how a memory may look like and what it contains. """ | |
21 def __init__(self, name): | 22 def __init__(self, name): |
22 self.inputs = [] | 23 self.inputs = [] |
23 self.name = name | 24 self.name = name |
24 self.location = 0x0 | 25 self.location = 0x0 |
25 self.size = 0x0 | 26 self.size = 0x0 |
31 def __repr__(self): | 32 def __repr__(self): |
32 return 'MEM {} loc={:08X} size={:08X}'.format(self.name, self.location, self.size) + str(self.inputs) | 33 return 'MEM {} loc={:08X} size={:08X}'.format(self.name, self.location, self.size) + str(self.inputs) |
33 | 34 |
34 def __eq__(self, other): | 35 def __eq__(self, other): |
35 return str(self) == str(other) | 36 return str(self) == str(other) |
37 | |
36 | 38 |
37 class Input: | 39 class Input: |
38 pass | 40 pass |
39 | 41 |
40 | 42 |