Skip to content

Commit

Permalink
litex/gen/common: Add short and long byte size definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jun 13, 2024
1 parent abdf6d3 commit d782a0f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions litex/gen/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ def colorer(s, color="bright", enable=True):
trailer = "\x1b[0m"
return (header + str(s) + trailer) if enable else str(s)

# Byte Size Definitions ----------------------------------------------------------------------------

# Short.
KB = 1024
MB = KB * 1024
GB = MB * 1024

# Long.
KILOBYTE = 1024
MEGABYTE = KILOBYTE * 1024
GIGABYTE = MEGABYTE * 1024

# Bit/Bytes Reversing ------------------------------------------------------------------------------

def reverse_bits(s):
Expand Down

0 comments on commit d782a0f

Please sign in to comment.