Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin rotations from DEF/LEF #209

Open
lelzeiny opened this issue Jan 6, 2025 · 16 comments
Open

Pin rotations from DEF/LEF #209

lelzeiny opened this issue Jan 6, 2025 · 16 comments

Comments

@lelzeiny
Copy link

lelzeiny commented Jan 6, 2025

Hello!

I'm adding to the DREAMPlace repo, but noticed that the pins in rawdb or pydb object in PlaceDB.py has "unrotated pins" from PyPlaceDB::convertOrient(), but rotated sizes. Why is that?

For example: if a LEF has a pin at (0, 3) when the component is sized 5 x 3 and the DEF defines the orientation as "placed west", I would expect the db report the pin to be at (0, 0). Instead, I've seen that its been rotated east to (3, 5).

@limbo018
Copy link
Owner

limbo018 commented Jan 7, 2025

Hi, I would like to confirm with you about the rotations. Could you check the following orientations correct?

image

@limbo018
Copy link
Owner

limbo018 commented Jan 7, 2025

image

@lelzeiny
Copy link
Author

lelzeiny commented Jan 7, 2025

Yes, that is what I expect too but I see this is not the case. I have linked a DEF/LEF of a simpler example.
simple00_def.txt
simple00_lef.txt

Looking at MAS2845 P2, the LEF component is 7 x 3 and the pin is at (5.5, 0) I would expect the pin to be at (3, 5.5) when rotated west. But the database offset reports (0, 1.5) which is consistent with it being rotated east. I think this problem originates here in PyPlaceDB::convertOrient() because the dest orientation is "N" and the src is the DEF orientation.

I have also run with these flags to maintain my current orientations:

"global_place_flag": 0,
"legalize_flag": 0,

@limbo018
Copy link
Owner

limbo018 commented Jan 7, 2025

I figured out the problem. The cases 90 and 270 in getRotatedPinOffsets should be swapped. Fixed in 44ca569

@lelzeiny
Copy link
Author

lelzeiny commented Jan 8, 2025

I don't think that resolves the bug, and it also doesn't address inconsistencies with "S". Although I mentioned it earlier, I also don't think it originates with convertOrient(), because I see the pin offsets before that function is called isn't directly from the LEF like I expected. I'll take a look at it later today though.

@limbo018
Copy link
Owner

limbo018 commented Jan 9, 2025

I verified the example you gave in simple00. It looks correct. Here is the log after I printed the pin offsets before and after rotation.

[INFO   ] -- Converting Node Orientation --
node a1
[DEBUG  ] original: node 0, orient W, sizes 701x384, pin 0 (559, 0), pin 1 (701, 384), 
[DEBUG  ] src_degree_flip = (90, 0), rot_degree = 270, flip = 0
node a1
[DEBUG  ] after rotation: node 0, orient N, sizes 384x701, pin 0 (384, 559), pin 1 (0, 701), 
node a2
[DEBUG  ] original: node 1, orient S, sizes 101x80, pin 0 (21, -21), 
[DEBUG  ] src_degree_flip = (180, 0), rot_degree = 180, flip = 0
node a2
[DEBUG  ] after rotation: node 1, orient N, sizes 101x80, pin 0 (80, 101), 

@lelzeiny
Copy link
Author

lelzeiny commented Jan 9, 2025

Thats my mistake. You are right, west and east are resolved.

But when I change the orientation to "S" and print the original / after rotation, my original changes from the LEF to be (142, 384) and the after rotation is the original (559, 0). Why would the original change? Same thing with a2 in your snippet.

@limbo018
Copy link
Owner

limbo018 commented Jan 9, 2025

To clarify: the original in the log means before rotation, where all cells have orientation "N".

I cannot catch your new question. Could you give an example?

@lelzeiny
Copy link
Author

lelzeiny commented Jan 9, 2025

Take a2 for example, the LEF states the pin is at (80, 101) meaning the rotated pin is at (21, -21). Your output for a2 shows the opposite (21, -21) -> (80, 101). The rotation is correct, but the original point was already rotated.

I was trying to point out in the prev comment the same thing happens to P0 when I change node a1.

@limbo018
Copy link
Owner

limbo018 commented Jan 9, 2025

The target of function convertOrient() is actually trying to regard a rotated cell as "N" equivalent. In the following example, which corresponds to a2, if you want to regard "S" as "N", then the pin is at (80, 101).

image

@lelzeiny
Copy link
Author

lelzeiny commented Jan 9, 2025

But the LEF places the pin at (80, 101) originally

MACRO MAS2822
	CLASS BLOCK ;
	SIZE 1.01 BY 0.8 ;
	ORIGIN 0 0 ;
	SYMMETRY X ;
	SITE core 0 0 N DO 1 BY 1 STEP 0 0 ;
	PIN P1
	DIRECTION INOUT ;
	USE SIGNAL ;
		PORT
			LAYER metal1 ;
				RECT 0.79495 1.006 0.80505 1.014 ;
		END
	END P1

@lelzeiny
Copy link
Author

lelzeiny commented Jan 9, 2025

I'll also be on this zoom for the next ~1hr if you have time: <>

@limbo018
Copy link
Owner

limbo018 commented Jan 9, 2025

I see your point. Will take a detailed look later. I have a meeting right now. Will come back to you.

@lelzeiny
Copy link
Author

lelzeiny commented Jan 9, 2025

Looks like PlaceDB.cpp rotated the Pin objects and changes the offset in the Pin.h object in PlaceDB::updateNodePinOffset() so the pin offsets are already rotated when accessed by PyPlaceDB.cpp.

@limbo018
Copy link
Owner

limbo018 commented Jan 9, 2025

You are right. Commenting line 1752-1755 in PlaceDB.cpp should resolve the issue. (

for (index_type i = 0, ie = numMovable() + numFixed(); i < ie; ++i) {
)

The pins were rotated twice.

@limbo018
Copy link
Owner

This commit (132474b) comments out line 1752-1755 in PlaceDB.cpp. It should resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants