Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

matrix decomposition

Status
Not open for further replies.

zaidali

Newbie level 5
Newbie level 5
Joined
Jul 5, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
118
hi
below is a matlab code for computing the QR decomposition ,i need the same program in vhdl , i tried to convert it but the result which i get after simulation is always wrong , i think my problem is in using the for loop statement in vhdl, i don't know how to use a nested loops , so plz if someone can help me coz i have to complete this program in a very short time


a=[1 2 3 4;1 1 2 5;1 2 4 1;3 3 2 1];
q=[0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0]
R=[0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0]

[m,n]=size(a)
for k=1:1:n
s=0;
for j=1:1:m;
s=s+a(j,k)^2
end
R(k,k)=sqrt(s)
for j=1:1:m
q(j,k)=a(j,k)/R(k,k)
end
for i=k+1:1:n
s=0;
for j=1:1:m
s=s+a(j,i)*q(j,k)
end
R(k,i)=s
for j=1:1:m
f=R(k,i)*q(j,k)
a(j,i)=a(j,i)-f
end
end
end
 

Yes, nested loops are the problem - you shouldnt be using them i VHDL.
I suggest drawing the circuit on paper before you move the VHDL. If you dont know how to do that, I suggest you start reading up on digital design.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top