@@ -180,37 +180,53 @@ package gwaihir_pkg;
180180 // Dummy tiles X, Y coordinates
181181 typedef id_t [NumDummyTiles- 1 : 0 ] dummy_idx_t ;
182182
183- // This function is used to identify
184- function automatic dummy_idx_t get_dummy_idx (mesh_map_t MeshMap, int Dim_x, int Dim_y);
185- dummy_idx_t dummy_idx;
186- int unsigned empty_tile = 0 ;
187- int unsigned found_tiles = 0 ;
183+ // For each (col, row) in MeshMap: if the column is not fully empty (has at least one
184+ // occupied tile) but this specific position is unoccupied, insert a dummy tile there.
185+ // The returned indices are in SAM-space coordinates (matching MeshMap).
186+ function automatic dummy_idx_t get_dummy_idx (mesh_map_t MeshMap);
187+ dummy_idx_t dummy_idx;
188+ int unsigned found_tiles;
189+ bit [MaxId.x: 0 ] empty_cols;
190+
191+ found_tiles = 0 ;
192+ empty_cols = get_empty_cols (MeshMap);
188193
189- // Count the number of columns that have at least one tile
190194 for (int col = 0 ; col <= MaxId.x; col++ ) begin
191- // Clear counter for the next column
192- empty_tile = 0 ;
193- for (int row = 0 ; row <= MaxId.y; row++ ) begin
194- if (MeshMap[row][col] == 1'b1 ) begin
195- end else if (empty_tile <= MaxId.y) begin
196- // If the tile is empty, we can add it to the dummy index
197- dummy_idx[found_tiles] = '{ x : col, y : row, port_id: 0 } ;
198- found_tiles++ ;
199- empty_tile++ ;
200- end else begin
201- // If the full column is empty, we don't need to insert dummy tiles
202- found_tiles - = empty_tile;
203- break ;
195+ if (! empty_cols[col]) begin
196+ for (int row = 0 ; row <= MaxId.y; row++ ) begin
197+ if (MeshMap[row][col] == 1'b0 ) begin
198+ dummy_idx[found_tiles] = '{ x: col, y: row, port_id: 0 } ;
199+ found_tiles++ ;
200+ end
204201 end
205202 end
206203 end
207204 return dummy_idx;
208205 endfunction
209206
210- // localparam dummy_idx_t DummyIdx = get_dummy_idx(MeshMap, MeshDim.x, MeshDim.y);
211- localparam dummy_idx_t DummyIdx = '{ '{ x : 9 , y : 0 , port_id : 0 }} ;
212- localparam dummy_idx_t DummyPhysicalIdx = '{ '{ x : 6 , y : 0 , port_id : 0 }} ;
207+ // For each SAM-space dummy index, subtract the number of fully-empty columns that lie
208+ // to its left. This gives the physical array index used to connect floo_req/rsp signals,
209+ // mirroring the same transformation applied to SamPhysical via align_x_coordinate.
210+ function automatic dummy_idx_t get_dummy_physical_idx (dummy_idx_t dummy_idx);
211+ dummy_idx_t ret;
212+ int unsigned left_empty_cols;
213+ int unsigned current_x;
214+
215+ for (int d = 0 ; d < NumDummyTiles; d++ ) begin
216+ current_x = int '(dummy_idx[d].x);
217+ left_empty_cols = 0 ;
218+ for (int col = 0 ; col < current_x; col++ ) begin
219+ if (EmptyCols[col] == 1'b1 ) left_empty_cols++ ;
220+ end
221+ ret[d].x = dummy_idx[d].x - left_empty_cols;
222+ ret[d].y = dummy_idx[d].y;
223+ ret[d].port_id = dummy_idx[d].port_id;
224+ end
225+ return ret;
226+ endfunction
213227
228+ localparam dummy_idx_t DummyIdx = get_dummy_idx (MeshMap);
229+ localparam dummy_idx_t DummyPhysicalIdx = get_dummy_physical_idx (DummyIdx);
214230
215231 // Whether the connection is a tie-off or a valid neighbor
216232 function automatic bit is_tie_off (int x, int y, route_direction_e dir);
@@ -345,68 +361,5 @@ package gwaihir_pkg;
345361 localparam int unsigned SramAddrWidthOffset = SramBankSelOffset + SramBankSelWidth;
346362 localparam int unsigned SramMacroSelOffset = SramAddrWidthOffset + SramAddrWidth;
347363
348- // //////////////////////
349- // SPM Narrow Tiles //
350- // //////////////////////
351-
352- // Narrow SPM tile size
353- localparam int unsigned SpmNarrowTileSize = ep_addr_size (TopSpmNarrowSamIdx);
354- // Narrow SPM number words per bank
355- localparam int unsigned SpmNarrowWordsPerBank = 2048 ; // in #words
356- // Narrow SPM dataWidth
357- localparam int unsigned SpmNarrowDataWidth = 64 ; // in bits
358-
359- // Narrow SPM number of banks per word
360- localparam int unsigned SpmNarrowNumBanksPerWord = AxiCfgN.DataWidth / SpmNarrowDataWidth;
361- // Narrow SPM number of bank rows
362- localparam int unsigned SpmNarrowNumBankRows = (SpmNarrowTileSize / (AxiCfgN.DataWidth / 8 )
363- / SpmNarrowWordsPerBank);
364-
365- // The number of LSBs to address the bytes in an SRAM word
366- localparam int unsigned SpmNarrowByteOffsetWidth = $clog2 (SpmNarrowDataWidth / 8 );
367- // The number of bits required to select the subbank for a Narrow word
368- localparam int unsigned SpmNarrowBankSelWidth = $clog2 (SpmNarrowNumBanksPerWord);
369- // The number of bits for the SpmNarrow address
370- localparam int unsigned SpmNarrowAddrWidth = $clog2 (SpmNarrowWordsPerBank);
371- // The number of bits to index the SpmNarrow macro
372- localparam int unsigned SpmNarrowMacroSelWidth = $clog2 (SpmNarrowNumBankRows);
373-
374- // Various offsets for the SpmNarrow address
375- localparam int unsigned SpmNarrowBankSelOffset = SpmNarrowByteOffsetWidth;
376- localparam int unsigned SpmNarrowAddrWidthOffset = SpmNarrowBankSelOffset + SpmNarrowBankSelWidth;
377- localparam int unsigned SpmNarrowMacroSelOffset = SpmNarrowAddrWidthOffset + SpmNarrowAddrWidth;
378-
379-
380- // ////////////////////
381- // SPM Wide Tiles //
382- // ////////////////////
383-
384- // Wide SPM tile
385- localparam int unsigned SpmWideTileSize = ep_addr_size (TopSpmWideSamIdx);
386- // Wide SPM number words per bank
387- localparam int unsigned SpmWideWordsPerBank = 1024 ; // in #words
388- // Wide SPM dataWidth
389- localparam int unsigned SpmWideDataWidth = 128 ; // in bits
390-
391- // Wide SPM number of banks per word
392- localparam int unsigned SpmWideNumBanksPerWord = AxiCfgW.DataWidth / SpmWideDataWidth;
393- // Wide SPM number of bank rows
394- localparam int unsigned SpmWideNumBankRows = (SpmWideTileSize / (AxiCfgW.DataWidth / 8 )
395- / SpmWideWordsPerBank);
396-
397- // The number of LSBs to address the bytes in an SRAM word
398- localparam int unsigned SpmWideByteOffsetWidth = $clog2 (SpmWideDataWidth / 8 );
399- // The number of bits required to select the subbank for a wide word
400- localparam int unsigned SpmWideBankSelWidth = $clog2 (SpmWideNumBanksPerWord);
401- // The number of bits for the SpmWide address
402- localparam int unsigned SpmWideAddrWidth = $clog2 (SpmWideWordsPerBank);
403- // The number of bits to index the SpmWide macro
404- localparam int unsigned SpmWideMacroSelWidth = $clog2 (SpmWideNumBankRows);
405-
406- // Various offsets for the SpmWide address
407- localparam int unsigned SpmWideBankSelOffset = SpmWideByteOffsetWidth;
408- localparam int unsigned SpmWideAddrWidthOffset = SpmWideBankSelOffset + SpmWideBankSelWidth;
409- localparam int unsigned SpmWideMacroSelOffset = SpmWideAddrWidthOffset + SpmWideAddrWidth;
410-
411364
412365endpackage
0 commit comments