1- from myhdl import block , always_seq , Signal , instances , ConcatSignal , enum , ResetSignal , always_comb
1+ from myhdl import block , always_seq , Signal , instances , ConcatSignal , enum , always_comb
22
33from framework .data_desc import get_input_desc , get_output_desc
44from framework .packed_struct import BitVector
@@ -17,12 +17,7 @@ def hram_handler(config, cp2af, af2cp, csr: CsrSignals, data_out: AsyncFifoProdu
1717 assert data_out .clk == data_in .clk
1818 assert data_out .rst == data_in .rst
1919 clk = data_out .clk
20-
21- reset = ResetSignal (True , True , False )
22-
23- @always_comb
24- def reset_driver ():
25- reset .next = data_out .rst or not csr .enb
20+ reset = data_out .rst
2621
2722 input_desc = get_input_desc (config .system_size )
2823 assert len (input_desc ) <= len (CcipClData )
@@ -56,7 +51,7 @@ def output_finished_driver():
5651
5752 @always_seq (clk .posedge , reset = None )
5853 def mem_reads_request ():
59- if reset :
54+ if reset or not csr . enb :
6055 af2cp .c0 .hdr .vc_sel .next = 0
6156 af2cp .c0 .hdr .rsvd1 .next = 0
6257 af2cp .c0 .hdr .cl_len .next = 3 # 4 CL's
@@ -99,40 +94,52 @@ def mem_reads_request():
9994 input_data_size = len (input_desc )
10095 input_data_iter = Signal (num .UnsignedIntegerNumberType (32 ).create (0 ))
10196
102- @always_seq (clk .posedge , reset = reset )
97+ @always_seq (clk .posedge , reset = None )
10398 def mem_reads_responses ():
104- if data_out .wr :
105- if not data_out .full :
106- nbr_inputs .next = nbr_inputs + 1
107- if input_data_iter + input_data_size <= chunk_size :
108- data_out .data .next = input_data_chunk [input_data_iter + input_data_size :input_data_iter ]
109- input_data_iter .next = input_data_iter + input_data_size
110- else :
111- data_out .wr .next = False
112- input_data_iter .next = 0
113- cl0_rcv .next = False
114- cl1_rcv .next = False
115- cl2_rcv .next = False
116- cl3_rcv .next = False
117- read_response_processing_ongoing .next = False
118- elif cl_rcv_vec == 0b1111 :
119- data_out .wr .next = True
120- data_out .data .next = input_data_chunk [input_data_iter + input_data_size :input_data_iter ]
121- input_data_iter .next = input_data_iter + input_data_size
122- read_response_processing_ongoing .next = True
123- elif cp2af .c0 .rspValid == 1 and cp2af .c0 .hdr .mdata == 0 :
124- if cp2af .c0 .hdr .cl_num == 0 :
125- cl0_data .next = cp2af .c0 .data
126- cl0_rcv .next = True
127- elif cp2af .c0 .hdr .cl_num == 1 :
128- cl1_data .next = cp2af .c0 .data
129- cl1_rcv .next = True
130- elif cp2af .c0 .hdr .cl_num == 2 :
131- cl2_data .next = cp2af .c0 .data
132- cl2_rcv .next = True
133- elif cp2af .c0 .hdr .cl_num == 3 :
134- cl3_data .next = cp2af .c0 .data
135- cl3_rcv .next = True
99+ if reset or not csr .enb :
100+ nbr_inputs .next = 0
101+ input_data_iter .next = 0
102+ read_response_processing_ongoing .next = False
103+
104+ data_out .wr .next = False
105+
106+ cl0_rcv .next = False
107+ cl1_rcv .next = False
108+ cl2_rcv .next = False
109+ cl3_rcv .next = False
110+ else :
111+ if data_out .wr :
112+ if not data_out .full :
113+ nbr_inputs .next = nbr_inputs + 1
114+ if input_data_iter + input_data_size <= chunk_size :
115+ data_out .data .next = input_data_chunk [input_data_iter + input_data_size :input_data_iter ]
116+ input_data_iter .next = input_data_iter + input_data_size
117+ else :
118+ data_out .wr .next = False
119+ input_data_iter .next = 0
120+ cl0_rcv .next = False
121+ cl1_rcv .next = False
122+ cl2_rcv .next = False
123+ cl3_rcv .next = False
124+ read_response_processing_ongoing .next = False
125+ elif cl_rcv_vec == 0b1111 :
126+ data_out .wr .next = True
127+ data_out .data .next = input_data_chunk [input_data_iter + input_data_size :input_data_iter ]
128+ input_data_iter .next = input_data_iter + input_data_size
129+ read_response_processing_ongoing .next = True
130+ elif cp2af .c0 .rspValid == 1 and cp2af .c0 .hdr .mdata == 0 :
131+ if cp2af .c0 .hdr .cl_num == 0 :
132+ cl0_data .next = cp2af .c0 .data
133+ cl0_rcv .next = True
134+ elif cp2af .c0 .hdr .cl_num == 1 :
135+ cl1_data .next = cp2af .c0 .data
136+ cl1_rcv .next = True
137+ elif cp2af .c0 .hdr .cl_num == 2 :
138+ cl2_data .next = cp2af .c0 .data
139+ cl2_rcv .next = True
140+ elif cp2af .c0 .hdr .cl_num == 3 :
141+ cl3_data .next = cp2af .c0 .data
142+ cl3_rcv .next = True
136143
137144 # Incremental counter used for iterating trough host array
138145 output_addr_offset = Signal (num .UnsignedIntegerNumberType (32 ).create (0 ))
@@ -146,7 +153,7 @@ def mem_reads_responses():
146153
147154 @always_seq (clk .posedge , reset = None )
148155 def reset_padding ():
149- if reset :
156+ if reset or not csr . enb :
150157 output_data_chunk_padding .next = 0
151158 else :
152159 output_data_chunk = ConcatSignal (* reversed (output_data ))
@@ -157,7 +164,7 @@ def reset_padding():
157164 # Host Memory Writes
158165 @always_seq (clk .posedge , reset = None )
159166 def mem_writes ():
160- if reset :
167+ if reset or not csr . enb :
161168 af2cp .c1 .hdr .rsvd2 .next = 0
162169 af2cp .c1 .hdr .vc_sel .next = 0
163170 af2cp .c1 .hdr .sop .next = 0
0 commit comments