Skip to content

Commit

Permalink
Defining project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
khwong-c committed Feb 18, 2024
1 parent cbf8c6f commit b12fb5a
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 2 deletions.
7 changes: 7 additions & 0 deletions magia/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""
Core Magia package
This index shall only import modules from this level of the package.
Sub-packages (e.g. magia.std, etc.) shall be imported in their respective __init__.py files.
"""

from importlib.util import find_spec

from .bundle import Bundle, BundleSpec, BundleType
Expand Down
7 changes: 7 additions & 0 deletions magia/bus/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""
Bus interfaces specifications.
Don't include specific protocol details or implement transaction logic here.
They will be handled separately later on.
e.g. AXI, AXI-Stream, Wishbone, etc.
"""
2 changes: 1 addition & 1 deletion magia/bus/axilite.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def axi4lite(
:param addr_width: The width of the address signal, default is 32.
"""
if data_width not in (32, 64):
raise ValueError("data_width must be eiter 32 or 64")
raise ValueError("data_width must be either 32 or 64")

# Define the AXI4-Lite signals
aw = decoupled_bundle([
Expand Down
16 changes: 16 additions & 0 deletions magia/format/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Numerical format conversions
This module provides classes for converting between different number formats,
such as fixed point and floating point numbers.
Put functions and classes here if:
- They convert Python floats to a different numerical format, or vice versa
- No operations and calculations logic is involved (e.g. addition, multiplication, etc.)
"""

from .fixed_point import FixedPoint

__all__ = [
"FixedPoint"
]
File renamed without changes.
10 changes: 10 additions & 0 deletions magia/generator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Logic and Structures Generator
This module is responsible for generating the logic and structural patterns
Include functions and classes here if:
- They are describing a design pattern
- They have high generality, regardless to bus protocols or specific IPs
e.g. FSM Builder, Feed-forward Pipeline Generator, etc.
"""
10 changes: 10 additions & 0 deletions magia/std/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Commonly used design blocks
Consider putting a design blocks here if:
- It is a commonly used design block, but not a full IP
- It can be described as a function that returns a signal
- It has less generality than a generator, with a limited number of parameters
e.g. Counter, FIFO, Fixed-Point Conversions, etc.
"""
8 changes: 8 additions & 0 deletions magia/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Utilities that only used by Magia
Put those tools here if:
- They are modifying data of the input of a function / class in Magia
e.g. Logic Optimization, etc.
"""
2 changes: 1 addition & 1 deletion tests/std/test_fixed_point.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from magia.std.fixed_point import FixedPoint
from magia.format import FixedPoint


class TestFixedPoint:
Expand Down

0 comments on commit b12fb5a

Please sign in to comment.