@@ -290,6 +290,79 @@ TEST_F(TileGeneratorTest, GetLayerColorMapMatchesGuiPalette)
290290 }
291291}
292292
293+ // Only frontside metals should consume the palette colors.
294+ TEST_F (TileGeneratorTest, GetLayerColorMapWithBacksideMetals)
295+ {
296+ odb::dbTech* tech = getDb ()->getTech ();
297+ ASSERT_NE (tech, nullptr );
298+
299+ // make metals 1 -> 3 backside
300+ for (const char * name :
301+ {" metal1" , " via1" , " metal2" , " via2" , " metal3" , " via3" }) {
302+ odb::dbTechLayer* layer = tech->findLayer (name);
303+ ASSERT_NE (layer, nullptr ) << " missing layer " << name;
304+ layer->setBackside (true );
305+ }
306+
307+ makeTileGen ();
308+ const auto & colors = tile_gen_->getLayerColorMap ();
309+
310+ // Helper: assert a layer's color matches an expected RGB (alpha is always
311+ // 180 in both the GUI and the web palette).
312+ auto expectColor = [&](const char * name, int r, int g, int b) {
313+ odb::dbTechLayer* layer = tech->findLayer (name);
314+ ASSERT_NE (layer, nullptr ) << " missing layer " << name;
315+ const Color c = colors.at (layer);
316+ EXPECT_EQ (c.r , r) << name << " red" ;
317+ EXPECT_EQ (c.g , g) << name << " green" ;
318+ EXPECT_EQ (c.b , b) << name << " blue" ;
319+ EXPECT_EQ (c.a , 180 ) << name << " alpha" ;
320+ };
321+
322+ struct LayerColor
323+ {
324+ const char * name;
325+ int r;
326+ int g;
327+ int b;
328+ };
329+
330+ // All 20 routing layers: metal1..metal14 are the seeded kMetalColors palette
331+ // (#00F, #F00, #0D0, ...), metal15..metal20 are the mt19937(1) overflow.
332+ const LayerColor kRouting [] = {// Backside
333+ {" metal1" , 209 , 191 , 141 },
334+ {" metal2" , 63 , 193 , 166 },
335+ {" metal3" , 200 , 166 , 92 },
336+ // Frontside
337+ {" metal4" , 0 , 0 , 254 },
338+ {" metal5" , 254 , 0 , 0 },
339+ {" metal6" , 9 , 221 , 0 },
340+ {" metal7" , 190 , 244 , 81 },
341+ {" metal8" , 222 , 33 , 96 },
342+ {" metal9" , 32 , 216 , 253 }};
343+
344+ // All 19 cut layers: via1..via14 are the seeded kCutColors palette,
345+ // via15..via19 are the mt19937(1) overflow.
346+ const LayerColor kCut [] = {// Backside
347+ {" via1" , 99 , 98 , 82 },
348+ {" via2" , 171 , 152 , 190 },
349+ {" via3" , 54 , 196 , 143 },
350+ // Frontside
351+ {" via4" , 126 , 126 , 255 },
352+ {" via5" , 255 , 126 , 126 },
353+ {" via6" , 4 , 110 , 0 },
354+ {" via7" , 95 , 122 , 40 },
355+ {" via8" , 111 , 17 , 48 },
356+ {" via9" , 16 , 108 , 126 }};
357+
358+ for (const LayerColor& lc : kRouting ) {
359+ expectColor (lc.name , lc.r , lc.g , lc.b );
360+ }
361+ for (const LayerColor& lc : kCut ) {
362+ expectColor (lc.name , lc.r , lc.g , lc.b );
363+ }
364+ }
365+
293366TEST_F (TileGeneratorTest, GetLayerColorMapIsCached)
294367{
295368 makeTileGen ();
0 commit comments