Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

Signal declaration and use

Altera_Forum
Honored Contributor II
2,200 Views

Here is my VHDL: " -- This VHDL code is the product for the Project required for EEL3705L. It is the creation of Lab partners Chad DeFranco and 

-- Jerry Walker. This program should allow paralled processing of data required for a MATLAB program that generates a visual  

-- display of a Synthetic Aperture Radar image. 

 

library IEEE; -- library STD;  

use IEEE.std_logic_1164.all; -- basic logic types 

use STD.textio.all; -- basic I/O 

use IEEE.std_logic_textio.all; -- I/O for logic types 

use IEEE.math_complex.all; -- I/O for complex numbers 

 

---------------------------------------------------------- 

ENTITY project IS 

end entity; 

 

ARCHITECTURE Numbers_Crunch OF project IS --MATLAB file XBAND_RMA_opendata. 

 

constant c : real := 3.0E6; 

constant Tp : real :=10.0E-3; 

constant at1 : real :=1.0; 

constant fmax : real :=12.817E9; 

constant fmin : real :=7.835E9; 

constant pulse : real :=10.0E3; 

constant Rs : real :=1.797; 

constant delta_x : real :=0.0254; 

constant L : real :=2.4384; 

constant Rt1 : real :=0.0; 

constant sif: complex_vector(1 to 2) := ((-1,-1), (1,0)); 

constant cal: complex_vector(1 to 2) := ((-1,-1), (1,0));  

 

signal Xa : real;  

signal t : real;  

signal Kr : real; 

signal phi_if1 : real; 

 

begin --begin for architecture 

process 

begin 

for j IN 1 TO 1000 LOOP -- create Xa array 

Xa(j) <= -L/2 + delta_x; 

END LOOP; 

 

for j in 1 to 1000 LOOP -- create t array 

t(j) <= t + Tp/1000; 

END LOOP; 

 

for j in 1 to 1000 LOOP -- create Kr array 

Kr(j) <= ((4*pi/c)*(fmin)) + (fmax-fmin)/1000; 

END LOOP; 

 

end process; 

phi_cal :  

for phif1_array in 1 to 1000 generate 

phi_if1 <= Kr*(-Rs); 

end generate Phi_cal; 

Calibrate : 

for cal_array in 1 to 1000 generate 

cal_theory <= at1*exp(-j*phi_if); 

end generate Calibrate; 

cf_calc :  

for cf_array in 1 to 1000 generate 

cf <= cal_theory/cal; 

end generate cf_calc; 

sif_calc : 

for cf_array in 1 to 96000 generate 

sif_out <= sif*cf; 

end generate sif_calc; 

 

-- extract values of sif_out, Rs, Kr, Xa 

end architecture;" My sif and cal constants have been abbreviated for editing and compiling purposes. I am concerned with the treatment of signal vectors. I would appreciate commentary concerning the proper way to handle signals.
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
1,132 Views

I dont know what the question is. I assume this is a simulation model because uyou cannot compile this code for and fpga

0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

btw this code will also not simulate as there are no wait statements in the process

0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

This code is for simulation only and will not run on any hardware device. A 96 element vector will be substituted in the sif constant and a 1000 element vector will be substituded in the cal constant. I'm new to VHDL and I have been led to suspect there is a problem with the way I have handled the signals.

0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

What kind of problem? have you simulated this code and does it do what you expect? What is your question? 

When do you plan to replace these constants? 

 

Currently, your code does nothing more than create an infinite loop (a process must have a sensitivity list OR wait statements or it will loop forever) and generates nothing more than constant values.
0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

The original goal was to write this MATLAB file in VHDL in an attempt to have faster processing due to parallel processing. This project is part of FSU's EEL3705L requirements. Evidently reading the supporting MATLAB data files are a VHDL programming problem in themselves so my professor suggested making the data files a constant. The same was considered for the output calculations as the data files would need converting back to a .MAT file. 

 

My current task is to get the program to simulate. The abbreviated sif and cal constants are placeholders for compilation purposes. I should get constants as out put as the original .m file generated constants for the follow on .m file 

%This RMA SAR algorithm was written by Gregory L. Charvat as part of his dissertation: 

%G. L. Charvat, ``A Low-Power Radar Imaging System," Ph.D. dissertation, 

%Dept. of Electrical and Computer Engineering, Michigan State University, 

%East Lansing, MI, 2007. 

%Please cite appropriately. 

%This algorithm was based on: 

%Range Migration Algorithm from ch 10 of Spotlight Synthetic Aperture Radar 

%Signal Processing Algorithms, Carrara, Goodman, and Majewski 

%The radar system used here is from the following sources: 

%G. L. Charvat. "Build a high resolution synthetic aperture radar imaging system in your backyard," MIT Haystack Observatory, May 12, 2010. 

%G. L. Charvat. "Low-Cost, High Resolution X-Band Laboratory Radar System for Synthetic Aperture Radar Applications." Austin Texas: Antennas Measurement Techniques Association conference, October 2006. 

%G. L. Charvat, L. C. Kempel. "Low-Cost, High Resolution X-Band Laboratory Radar System for Synthetic Aperture Radar Applications." East Lansing, MI: IEEE Electro/Information Technology Conference, May 2006. 

%G. L. Charvat, "Low-cost, high-resolution, X-band laboratory radar system for synthetic aperture radar applications," Michigan State University Chapter of the IEEE, January 31, 2007 

%Radar specifications: 

% LFM chirp from 7.835 GHz - 12.817 GHz in 10 mS 

% TX power = 15 dBm 

% TX and RX beamwidth = 25 deg both E and H planes 

% rail SAR length is 96" 

% cross-range sample spacing = 1" 

%Data: Target scene of pushpins (thumbtacks). Acquired in May of 2006 while in graduate school as part of the 

%Electromagnetics Group at Michigan State University 

clear all; 

c = 3E8; %(m/s) speed of light 

%********************************************************************* 

%load IQ converted data here 

load rback_cl s; %load variable sif %for background subtraction cal data 

%********************************************************************* 

%perform background subtraction 

sif_sub = s; 

load rgostate_cl s; %load variable sif %for image data 

sif = s - sif_sub; %perform coherent background subtraction 

%sif = s; %image without background subtraction 

%sif = sif_sub; %image the background 

clear s ss; 

clear sif_sub; 

%*********************************************************************** 

%radar parameters 

fc = (12.817E9 - 7.835E9)/2 +7.835E9; %(Hz) center radar frequency 

B = (12.817E9 - 7.835E9); %(hz) bandwidth 

cr = B/10E-3; %(Hz/sec) chirp rate 

Tp = 10E-3; %(sec) pulse width 

%VERY IMPORTANT, change Rs to distance to cal target 

Xa = 0; %(m) beginning of new aperture length 

delta_x = 1*(1/12)*0.3048; %(m) 2 inch antenna spacing 

L = delta_x*(size(sif,1)); %(m) aperture length 

Xa = linspace(-L/2, L/2, (L/delta_x)); %(m) cross range position of radar on aperture L 

Za = 0; 

t = linspace(0, Tp, size(sif,2)); %(s) fast time, CHECK SAMPLE RATE 

Kr = linspace(((4*pi/c)*(fc - B/2)), ((4*pi/c)*(fc + B/2)), (size(t,2))); 

%************************************************************************ 

%callibration 

load rcal71 s; %load callibration file to standard target 

Rs = (71/12)*.3048; %(m) y coordinate to scene center (down range), make this value equal to distance to cal target 

Ya = Rs; %SEE GEOMETRY FIGURE 10.6 

s_cal = s; 

load rcalback s; %load background data for cal to standard target 

s_cal = s_cal - s; %perform background subtraction 

cal = s_cal; 

%calculate ideal cal target parameters 

%target parameters, 3 targets 

at1 = 1; %amplitude of cal target 

xt1 = 0; 

yt1 = Rs; %(m) distance to cal target 

zt1 = 0; 

%Rt and Rb for 1 cal target according to equation 10.26 

Rb1 = sqrt((Ya - yt1)^2 + (Za - zt1)^2); 

xa = 0; 

Rt1 = sqrt((xa - xt1).^2 + Rb1^2); 

Kr = linspace(((4*pi/c)*(fc - B/2)), ((4*pi/c)*(fc + B/2)), (size(t,2))); %according to range defined on bottom of page 410 

for ii = 1:size(t,2) %step thru each time step to find phi_if  

phi_if1(ii) = Kr(ii)*(Rt1 - Rs); 

end 

cal_theory = at1*exp(-j*phi_if1); 

clear phi_if1; 

%calculate the calibration factor 

cf = cal_theory./(cal); 

%apply the cal data 

for ii = 1:size(sif,1) 

sif(ii,:) = sif(ii,:).*cf; %turn off cal 

end 

%Save background subtracted and callibrated data 

save sif sif delta_x Rs Kr Xa Rs; 

%clear all; 

%run IFP 

XBAND_RMA_IFP;
0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

At this stage of my project, I probably should have created a logic circuit that would light up the DE2 7 segment displays in 6's and 7's when a person breaks wind at a 7+ magnitude.

0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

Writing a direct translation of the matlab into VHDL is a terrible idea. It will run slower than matlab (in simulation) and it will not synthesise. Simulation does NOT do anything for your parrallisation - that comes through synthesis. The only way to get there is to architect your circuit on paper before moving to VHDL. VHDL is a description language - if you dont know what you're describing, it will never work.

0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

I'm now getting this when I compile. 

 

Info (12021): Found 2 design units, including 1 entities, in source file project.vhd 

Info (12022): Found design unit 1: project-Numbers_Crunch 

Info (12023): Found entity 1: project 

Error (10482): VHDL error at project.vhd(31): object "complex_vector" is used but not declared 

Error: Quartus II 32-bit Analysis & Synthesis was unsuccessful. 1 error, 1 warning 

Error: Peak virtual memory: 328 megabytes 

Error: Processing ended: Mon Nov 18 15:28:31 2013 

Error: Elapsed time: 00:00:02 

Error: Total CPU time (on all processors): 00:00:01 

Error (293001): Quartus II Full Compilation was unsuccessful. 3 errors, 1 warning 

 

How do I correct this, "Error (10482): VHDL error at project.vhd(31): object "complex_vector" is used but not declared"
0 Kudos
Altera_Forum
Honored Contributor II
1,132 Views

declare complex_vector.

0 Kudos
Reply