projects
/
sv2nmigen.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
convert numbers to python format
[sv2nmigen.git]
/
parse_sv.py
diff --git
a/parse_sv.py
b/parse_sv.py
index 6a153fffe282fa2aafa6f7a762e98809ef11656e..9ca18f6f5a6ea834d2372b18d7f4decd2216f5b8 100644
(file)
--- a/
parse_sv.py
+++ b/
parse_sv.py
@@
-2350,6
+2350,11
@@
def p_number_1(p):
if(parse_debug):
print('number_1', list(p))
if(parse_debug):
print('number_1', list(p))
+ p[1] = p[1].replace("'b", "0b")
+ p[1] = p[1].replace("'x", "0x")
+ num = Leaf(token.NUMBER, "%s" % (p[1]))
+ p[0] = num
+
# { p[0] = p[1]; based_size = 0;}
()
# { p[0] = p[1]; based_size = 0;}
()
@@
-2359,6
+2364,8
@@
def p_number_2(p):
'''number : DEC_NUMBER '''
if(parse_debug):
print('number_2', list(p))
'''number : DEC_NUMBER '''
if(parse_debug):
print('number_2', list(p))
+ p[1] = p[1].replace("'b", "0b")
+ p[1] = p[1].replace("'x", "0x")
num = Leaf(token.NUMBER, "%s" % (p[1]))
p[0] = num
num = Leaf(token.NUMBER, "%s" % (p[1]))
p[0] = num
@@
-2371,7
+2378,11
@@
def p_number_3(p):
'''number : DEC_NUMBER BASED_NUMBER '''
if(parse_debug):
print('number_3', list(p))
'''number : DEC_NUMBER BASED_NUMBER '''
if(parse_debug):
print('number_3', list(p))
- num = Leaf(token.NUMBER, "%s:%s" % (p[1], p[2]))
+
+ p[2] = p[2].replace("'b", "0b")
+ p[2] = p[2].replace("'x", "0x")
+
+ num = Leaf(token.NUMBER, "%s" % (p[2]))
p[0] = num
p[0] = num
@@
-6237,8
+6248,11
@@
def p_expression_46(p):
if(parse_debug):
print('expression_46', list(p))
if(parse_debug):
print('expression_46', list(p))
- p[0] = Node(syms.atom, [p[1], Leaf(token.STRING, ' ? '),
- p[4], Leaf(token.STRING, ' : '), p[6]])
+ try:
+ p[0] = Node(syms.atom, [p[1], Leaf(token.STRING, ' ? '),
+ p[4], Leaf(token.STRING, ' : '), p[6]])
+ except:
+ p[0] = "error in PETernary"
# { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
# { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
@@
-7648,6
+7662,9
@@
def p_hierarchy_identifier_3(p):
if(parse_debug):
print('hierarchy_identifier_3', list(p))
if(parse_debug):
print('hierarchy_identifier_3', list(p))
+ p[0] = Node(syms.atom, [p[1], Leaf(
+ token.STRING, '['), p[3], Leaf(token.STRING, ']')])
+
# { pform_name_t * tmp = p[1];
# name_component_t&tail = tmp->back();
# { pform_name_t * tmp = p[1];
# name_component_t&tail = tmp->back();
@@
-9148,6
+9165,8
@@
def p_module_item_40(p):
if(parse_debug):
print('module_item_40', list(p))
if(parse_debug):
print('module_item_40', list(p))
+ absyn.always_ff(p[3], p[1])
+
# { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
# FILE_NAME(tmp, @2);
# { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
# FILE_NAME(tmp, @2);
@@
-12279,6
+12298,8
@@
def p_statement_item_30(p):
if(parse_debug):
print('statement_item_30', list(p))
if(parse_debug):
print('statement_item_30', list(p))
+ p[0] = [p[1], p[2]]
+
# { PEventStatement*tmp = p[1];
# if (tmp == 0) {
# { PEventStatement*tmp = p[1];
# if (tmp == 0) {
@@
-12365,6
+12386,8
@@
def p_statement_item_35(p):
if(parse_debug):
print('statement_item_35', list(p))
if(parse_debug):
print('statement_item_35', list(p))
+ p[0] = absyn.assign3(p[1], p[2], p[3])
+
# { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
# FILE_NAME(tmp, @1);
# { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
# FILE_NAME(tmp, @1);