Skip to content

Commit 8592d21

Browse files
committed
Better control over the state encodings.
- State encodings are now generated as UCProgramBlock classes are created. - This will make it easier to de-reference block names and get their encoding value. On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) Changes to be committed: modified: pyucode/UCProgram.py modified: templates/ucore-template.v
1 parent 05cf4d8 commit 8592d21

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pyucode/UCProgram.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ class UCProgramBlock(object):
7878
flow statement at the end.
7979
"""
8080

81+
__count__ = 0
82+
8183
def __init__(self, name, statements, flow_change):
8284
"""
8385
Create a new program block with the supplied statments and control
8486
flow change at the end.
8587
"""
88+
self.id = UCProgramBlock.__count__
89+
UCProgramBlock.__count__ = UCProgramBlock.__count__ + 1
8690
self.log = logging.getLogger(__name__)
8791
self.name = name
8892
self.statements = statements
@@ -219,7 +223,7 @@ def synth_state_encodings(self):
219223

220224
for block in self.blocks:
221225

222-
tr.append(self.get_block_state_name(block))
226+
tr.append((self.get_block_state_name(block), block.id))
223227

224228
return tr
225229

templates/ucore-template.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ assign {{variable.name}} = {{variable.comb_expr}}; // Not implemented yet.
6666
//
6767
// State encodings.
6868
{%- for statename in program.synth_state_encodings() %}
69-
localparam {{statename}} = {{loop.index0}};
69+
localparam {{statename[0]}} = {{statename[1]}};
7070
{%- endfor %}
7171

7272
//

0 commit comments

Comments
 (0)