@@ -758,8 +758,10 @@ class LitePCIeDMAStatus(LiteXModule):
758
758
the internal DMA status and the last 8 words for optional external status. The mapping as follows:
759
759
760
760
0: Sync Word (0x5aa55aa5).
761
- 1: DMA Writer Loop Status.
762
- 2: DMA Reader Loop Status.
761
+ 1: DMA Writer Loop Status 32-bit LSB.
762
+ 2: DMA Reader Loop Status 32-bit LSB.
763
+ 3: DMA Writer Loop Status 32-bit MSB (Optional).
764
+ 4: DMA Reader Loop Status 32-bit MSB (Optional).
763
765
3-7: Reserved
764
766
8-15: External (Optional, from user logic/design).
765
767
@@ -769,7 +771,8 @@ class LitePCIeDMAStatus(LiteXModule):
769
771
- DMA Reader IRQ.
770
772
Allowing a Synchronous or Asynchrounous update with the DMAs.
771
773
"""
772
- def __init__ (self , endpoint , writer , reader , address_width = 32 ):
774
+ def __init__ (self , endpoint , writer , reader , address_width = 32 , status_width = 32 ):
775
+ assert status_width in [32 , 64 ]
773
776
self .control = CSRStorage (fields = [
774
777
CSRField ("enable" , offset = 0 , size = 1 , description = "Status Enable" ),
775
778
CSRField ("update" , offset = 4 , size = 2 , description = "Status Update Event" , values = [
@@ -798,6 +801,38 @@ def __init__(self, endpoint, writer, reader, address_width=32):
798
801
status [1 ].eq (writer .table .loop_status .status ),
799
802
status [2 ].eq (reader .table .loop_status .status ),
800
803
]
804
+ if status_width == 64 :
805
+ class DMAStatusMSB (LiteXModule ):
806
+ def __init__ (self , enable , lsb ):
807
+ self .value = value = Signal (32 )
808
+
809
+ # # #
810
+
811
+ lsb_new = lsb [- 16 :]
812
+ lsb_last = Signal (16 )
813
+
814
+ self .sync += [
815
+ lsb_last .eq (lsb_new ),
816
+ If ((lsb_new == 0x0000 ) & (lsb_last == 0xffff ),
817
+ value .eq (value + 1 )
818
+ ),
819
+ If (enable == 0 ,
820
+ value .eq (0 )
821
+ ),
822
+ ]
823
+
824
+ self .writer_status_msb = DMAStatusMSB (
825
+ enable = writer .enable ,
826
+ lsb = writer .table .loop_status .status ,
827
+ )
828
+ self .reader_status_msb = DMAStatusMSB (
829
+ enable = reader .enable ,
830
+ lsb = reader .table .loop_status .status ,
831
+ )
832
+ self .comb += [
833
+ status [3 ].eq (self .writer_status_msb .value ),
834
+ status [4 ].eq (self .reader_status_msb .value ),
835
+ ]
801
836
802
837
# 7-15: External.
803
838
for i in range (8 ):
@@ -887,7 +922,7 @@ def __init__(self, phy, endpoint, with_table=True, table_depth=256, address_widt
887
922
# Monitor.
888
923
with_monitor = False ,
889
924
# Status.
890
- with_status = False ,
925
+ with_status = False , status_width = 32 ,
891
926
):
892
927
# Parameters -------------------------------------------------------------------------------
893
928
self .data_width = data_width or phy .data_width
@@ -962,6 +997,8 @@ def __init__(self, phy, endpoint, with_table=True, table_depth=256, address_widt
962
997
writer = self .writer ,
963
998
reader = self .reader ,
964
999
address_width = address_width ,
1000
+ status_width = status_width ,
1001
+
965
1002
)
966
1003
967
1004
def add_plugin_module (self , m ):
0 commit comments