From d782a0f8c6b126f59ff8144a76a42f6b43744d72 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 13 Jun 2024 09:54:06 +0200 Subject: [PATCH] litex/gen/common: Add short and long byte size definitions. --- litex/gen/common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/litex/gen/common.py b/litex/gen/common.py index 101243038..a89d1a2f1 100644 --- a/litex/gen/common.py +++ b/litex/gen/common.py @@ -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):