Skip to content

Commit 1afbe7e

Browse files
committed
updated doc for bitpattern_to_val
1 parent 998ad91 commit 1afbe7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyrtl/helperfuncs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def field_name(name):
266266
return MatchedFields(match, fields)
267267

268268

269+
# TODO: not currently tested or exported at package level
269270
def bitpattern_to_val(bitpattern, *ordered_fields, **named_fields):
270271
""" Return an unsigned integer representation of field format filled with the provided values.
271272
@@ -287,7 +288,10 @@ def bitpattern_to_val(bitpattern, *ordered_fields, **named_fields):
287288
Examples::
288289
289290
bitpattern_to_val('0000000rrrrrsssss000ddddd0110011', r=1, s=2, d=3) # RISCV ADD instr
290-
bitpattern_to_val('iiiiiiirrrrrsssss010iiiii0100011', i=0, r=3, s=4) # RISCV SW instr
291+
# evaluates to 0b00000000000100010000000110110011
292+
293+
bitpattern_to_val('iiiiiiirrrrrsssss010iiiii0100011', i=1, r=3, s=4) # RISCV SW instr
294+
# evaluates to 0b00000000001100100010000010100011
291295
292296
"""
293297

0 commit comments

Comments
 (0)