Lab Instructions-2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Complete the code to determine the analytical placement of “Lab1NetlistFinal.

txt”

You may test your code by using the “Lab1TestNetlist.txt”

You may manually change the Weight Vector according to the given:

ALL OTHER NETS HAVE A WEIGHT OF 1


The Correct Answers for the “Lab1TestNetlist.txt” are the following:
After you correctly placed the “Lab1TestNetlist.txt”, use the code to place “Lab1NetlistFinal.txt” and plot
it here:

https://spark-public.s3.amazonaws.com/vlsicad/javascript_tools/visualize.html

LAB1_PLACEMENT

10

11

12

13

14

15

16

17

18
Lab1NetlistFinal

18 20

1 2 20 19

2221

3 2 1 18

43345

56654378

6294

7 2 10 3

8 2 19 9

9 2 9 10

10 4 11 10 12 13

11 2 12 16

12 2 7 6

13 2 12 11

14 2 14 17

15 2 8 15

16 5 15 16 17 18 7

17 4 16 17 18 14

18 5 13 16 17 18 12

1 12 25 0

2 17 50 100

3 18 100 50

4 2 0 50

5 19 0 25

6 20 75 100
Lab1TestNetlist

5 11

13123

243468

3 4 2 4 5 11

445679

5 3 7 8 10

1101

2911

3 10 0.5 0

4 11 1 0

Unfinished Code

clear;clc;

t = dlmread('Lab1Netlist.txt');

MaxG = t(1,1);

MaxN = t(1,2);

MaxP = t(MaxG+2,1);

Gatelist = t(2:MaxG+1,:);

[m n] = size(Gatelist);

PadlistOnly = t(MaxG+3:MaxG+MaxP+2,:);

x=PadlistOnly(:,1)+MaxG;

y=PadlistOnly(:,2);

PadlistToGate = [x,y];

[mP nP] = size(PadlistToGate);

PadlistToGate = [PadlistToGate, zeros(mP, n-3)];


NetsConnectedtoGates = Gatelist(:,2);

OnlyGatelist = [Gatelist(:,1),Gatelist(:,3:n)];

OnlyGatelist = [OnlyGatelist; PadlistToGate];

Netlist = [1:MaxN]';

[mOGL nOGL]=size(OnlyGatelist);

for k=1:mOGL

for K=2:nOGL

if (OnlyGatelist(k,K)>0)

[mLoop nLoop]=size(nonzeros(Netlist(OnlyGatelist(k,K),:)));

Netlist(OnlyGatelist(k,K),mLoop+1)=k;

end

end

end

for q = 1:MaxN

[o p] = size(nonzeros(Netlist(q,:)));

NetSize(q)=o-1;

NetWeight(q) = 1/(o-2);

end

NetSize = NetSize';

NetWeight = NetWeight';

[mN nN] = size(Netlist);

ExNetlistPair = zeros(1,3);

for f=1:mN

try
[a s]=size(nonzeros(Netlist(f,:)));

Temp = nchoosek(Netlist(f,2:a),2);

[u i] = size(Temp);

Temp = [f*ones(u,1),Temp];

ExNetlistPair = [ExNetlistPair;Temp];

catch

end

end

[mEx nEx]= size(ExNetlistPair);

ExNetlistPair = ExNetlistPair(2:mEx,:)

[mEx nEx]= size(ExNetlistPair);

ExWeight=0;

for w=1:mEx

ExWeight(w)=NetWeight(ExNetlistPair(w,1));

end

ExWeight=ExWeight';

Netlist = [ExNetlistPair,ExWeight];

C=zeros(MaxG);

[mC nC] = size(Netlist);

NetWithPad = Netlist;

for c=1:mC

for v=2:3

if (Netlist(c,v)>MaxG)

Netlist(c,v)=0;
end

end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%PUT YOUR CODE HERE%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%

X=linsolve(A,bx);

Y=linsolve(A,by);

Gates=[1:MaxG]';

Coords = [Gates, X,Y]

You might also like