📄 targetgen.vhd
字号:
end if;
end process;
------------------------------------------------------------------------
------------------------------------------------------------------------
--产生3v固定目标
FIX_TARGET_3V_AZIP_ENABLE_GENERATE:
process(ClkTrgt, Rst, ShfOut, FixTrgt3vHalfWidth)
variable cnt : integer range 0 to 16#5FFFFFF#;
variable shfout_r : std_logic;
begin
if(Rst = '1') then
cnt := 0;
shfout_r := '0';
FixTrgt3vAzipEn <= false;
elsif rising_edge(ClkTrgt) then
if(ShfOut = '1' and shfout_r = '0') then
cnt := 0;
FixTrgt3vAzipEn <= false;
end if;
--目标的中心方位在FixTrgt1Azip上
if(cnt >= FixTrgt1Azip - FixTrgt3vHalfWidth
and cnt <= FixTrgt1Azip + FixTrgt3vHalfWidth) then
FixTrgt3vAzipEn <= true;
--目标的中心方位在FixTrgt2Azip上
elsif(cnt >= FixTrgt2Azip - FixTrgt3vHalfWidth
and cnt <= FixTrgt2Azip + FixTrgt3vHalfWidth) then
FixTrgt3vAzipEn <= true;
else
FixTrgt3vAzipEn <= false;
end if;
cnt := cnt + 1;
shfout_r := ShfOut;
end if;
end process;
--注意,这个乘法器与0.5v目标的乘法器产生相同结果,会产生综合错误
-- FixTrgt3vHalfWidth <= FixTrgtBeamHalfNum * TrigPeriod;
--指标中的3v和0.5v固定目标的宽度是相同的,因此直接赋值
FixTrgt3vHalfWidth <= FixTrgt05vHalfWidth;
FIX_TARGET_3V_GENERATE:
process(ClkTrgt, Rst, FixTrgt3vAzipEn, TrigOut)
variable cnt : integer range 0 to 16#FFFF#;
variable trigout_r : std_logic;
begin
if(Rst = '1') then
cnt := 0;
trigout_r := '0';
FixTrgt3vVideoOut <= '0';
elsif rising_edge(ClkTrgt) then
if(FixTrgt3vAzipEn) then
if(TrigOut = '1' and trigout_r = '0') then
cnt := 0;
end if;
if(cnt >= FixTrgt3vRng - FixTrgt3vHalfLength
and cnt <= FixTrgt3vRng + FixTrgt3vHalfLength) then
FixTrgt3vVideoOut <= '1';
else
FixTrgt3vVideoOut <= '0';
end if;
cnt := cnt + 1;
trigout_r := TrigOut;
else
FixTrgt3vVideoOut <= '0';
cnt := 0;
end if;
end if;
end process;
------------------------------------------------------------------------
------------------------------------------------------------------------
--产生运动目标1
MOVE_TARGET_1_AZIP_ENABLE_GENERATE:
process(Rst, ClkTrgt, ShfOut, MovTrgtHalfWidth)
variable cnt : integer range 0 to 16#5FFFFFF#; --对一周内的原始时钟进行计数
variable shfout_r : std_logic;
variable scannum : integer range 0 to MovTrgt1OutRng; --对天线周期进行计数
variable flag : boolean;
begin
if(Rst = '1') then
cnt := 0;
shfout_r := '0';
MovTrgt1AzipEn <= false;
flag := true;
scannum := 0;
elsif rising_edge(ClkTrgt) then
if(scannum = MovTrgt1OutRng) then
scannum := 0;
end if;
if(ShfOut = '1' and shfout_r = '0') then
cnt := 0;
scannum := scannum + 1;
end if;
if(scannum <= MovTrgt1Pass) then --运动目标在本船前方
--运动目标1在本船船首线上,方位计数有从最大值到0的跨越,因此用判断使能为假的条件
if(cnt > MovTrgt1Azipa + MovTrgtHalfWidth
and cnt < OneScan - MovTrgtHalfWidth) then
MovTrgt1AzipEn <= false;
else
MovTrgt1AzipEn <= true;
end if;
elsif(scannum <= MovTrgt1OutRng) then --目标在本船后方
if(cnt >= MovTrgt1Azipb - MovTrgtHalfWidth
and cnt <= MovTrgt1Azipb + MovTrgtHalfWidth) then
MovTrgt1AzipEn <= true;
else
MovTrgt1AzipEn <= false;
end if;
else
MovTrgt1AzipEn <= false;
end if;
cnt := cnt + 1;
shfout_r := ShfOut;
end if;
end process;
-- MovTrgtHalfWidth <= MovTrgtBeamHalfNum * TrigPeriod;
MovTrgtHalfWidth <= FixTrgt05vHalfWidth;
--计算每个天线周期运动目标1在径向上的中心位置
MOVE_TARGET_1_RANGE_COUNT_GENERATE:
process(ClkTrgt, Rst, ShfOut)
variable cnt : integer range 0 to MovTrgt1OutRng;
variable shfout_r : std_logic;
begin
if(Rst = '1') then
cnt := 0;
shfout_r := '0';
MovTrgt1RngCnt <= MovTrgt1RngOrg;
elsif rising_edge(ClkTrgt) then
if(cnt = MovTrgt1OutRng) then
cnt := 0;
end if;
if(shfout_r = '0' and ShfOut = '1') then
if(cnt = 0) then
MovTrgt1RngCnt <= MovTrgt1RngOrg;
elsif(cnt < MovTrgt1Pass) then
MovTrgt1RngCnt <= MovTrgt1RngCnt - MovTrgt1RngDelta;
elsif(cnt = MovTrgt1Pass) then
MovTrgt1RngCnt <= 0;
elsif(cnt < MovTrgt1OutRng) then
MovTrgt1RngCnt <= MovTrgt1RngCnt + MovTrgt1RngDelta;
else
MovTrgt1RngCnt <= 0;
end if;
cnt := cnt + 1;
end if;
shfout_r := ShfOut;
end if;
end process;
MOVE_TARGET_1_VIDEO_GENERATE:
process(ClkTrgt, Rst, MovTrgt1RngCnt, MovTrgt1AzipEn, TrigOut)
variable cnt : integer range 0 to RadarRng;
-- variable shfcnt : integer range 0 to MovTrgt1OutRng;
-- variable shfout_r : std_logic;
variable trigout_r : std_logic;
begin
if(Rst = '1') then
MovTrgt1VideoOut <= '0';
cnt := 0;
trigout_r := '0';
elsif rising_edge(ClkTrgt) then
if(MovTrgt1AzipEn) then
if((TrigOut = '1' and trigout_r = '0') or cnt = RadarRng) then
cnt := 0;
end if;
if(MovTrgt1RngCnt <= MovTrgtHalfLength) then --目标中心位置小于目标大小的一半
if(cnt <= MovTrgtHalfLength) then
MovTrgt1VideoOut <= '1';
else
MovTrgt1VideoOut <= '0';
end if;
else
if(cnt >= MovTrgt1RngCnt - MovTrgtHalfLength
and cnt <= MovTrgt1RngCnt + MovTrgtHalfLength) then
MovTrgt1VideoOut <= '1';
else
MovTrgt1VideoOut <= '0';
end if;
end if;
cnt := cnt + 1;
trigout_r := TrigOut;
else
MovTrgt1VideoOut <= '0';
end if;
end if;
end process;
------------------------------------------------------------------------
------------------------------------------------------------------------
--产生运动目标3
MOVE_TARGET_3_AZIP_ENABLE_GENERATE:
process(Rst, ClkTrgt, ShfOut)
variable cnt : integer range 0 to 16#5FFFFFF#;
variable scannum : integer range 0 to MovTrgt3OutRng;
variable shfout_r : std_logic;
begin
if(Rst = '1') then
cnt := 0;
shfout_r := '0';
MovTrgt3AzipEn <= false;
scannum := 0;
elsif rising_edge(ClkTrgt) then
if(scannum = MovTrgt3OutRng) then
scannum := 0;
end if;
if(ShfOut = '1' and shfout_r = '0') then
cnt := 0;
scannum := scannum + 1;
end if;
if(scannum <= MovTrgt3Pass) then
if(cnt >= MovTrgt3Azipa - MovTrgtHalfWidth
and cnt <= MovTrgt3Azipa + MovTrgtHalfWidth) then
MovTrgt3AzipEn <= true;
else
MovTrgt3AzipEn <= false;
end if;
elsif(scannum <= MovTrgt3OutRng) then
if(cnt >= MovTrgt3Azipb - MovTrgtHalfWidth
and cnt <= MOvTrgt3Azipb + MovtrgtHalfWidth) then
MovTrgt3AzipEn <= true;
else
MovTrgt3AzipEn <= false;
end if;
else
MovTrgt3AzipEn <= false;
end if;
cnt := cnt + 1;
shfout_r := ShfOut;
end if;
end process;
MOVE_TARGET_3_RANGE_COUNT_GENERATE:
process(ClkTrgt, Rst, ShfOut)
variable cnt : integer range 0 to MovTrgt3OutRng;
variable shfout_r : std_logic;
begin
if(Rst = '1') then
cnt := 0;
shfout_r := '0';
MovTrgt3RngCnt <= MovTrgt3RngOrg;
elsif rising_edge(ClkTrgt) then
if(cnt = MovTrgt3OutRng) then
cnt := 0;
end if;
if(shfout_r = '0' and ShfOut = '1') then
if(cnt = 0) then
MovTrgt3RngCnt <= MovTrgt3RngOrg;
elsif(cnt < MovTrgt3Pass) then
MovTrgt3RngCnt <= MovTrgt3RngCnt - MovTrgt3RngDelta;
elsif(cnt = MovTrgt3Pass) then
MovTrgt3RngCnt <= 0;
elsif(cnt < Movtrgt3OutRng) then
MovTrgt3RngCnt <= MovTrgt3RngCnt + MovTrgt3RngDelta;
else
MovTrgt3RngCnt <= 0;
end if;
cnt := cnt + 1;
end if;
shfout_r := ShfOut;
end if;
end process;
MOVE_TARGET_3_VIDEO_GENEATE:
process(ClkTrgt, Rst, MovTrgt3RngCnt, MovTrgt3AzipEN, TrigOut)
variable cnt : integer range 0 to RadarRng;
variable trigout_r : std_logic;
begin
if(Rst = '1') then
MovTrgt3VideoOut <= '0';
cnt := 0;
elsif rising_edge(ClkTrgt) then
if(MovTrgt3AzipEn) then
if((TrigOut = '1' and trigout_r = '0') or cnt = RadarRng) then
cnt := 0;
end if;
if(MovTrgt3RngCnt <= MovTrgtHalfLength) then
if(cnt <= MovTrgtHalfLength) then
MovTrgt3VideoOut <= '1';
else
MovTrgt3VideoOut <= '0';
end if;
else
if(cnt >= MovTrgt3RngCnt - MovTrgtHalfLength
and cnt <= MovTrgt3RngCnt + MovTrgtHalfLength) then
MovTrgt3VideoOut <= '1';
else
MovTrgt3VideoOut <= '0';
end if;
end if;
cnt := cnt + 1;
trigout_r := TrigOut;
else
MovTrgt3VideoOut <= '0';
end if;
end if;
end process;
------------------------------------------------------------------------
------------------------------------------------------------------------
-- 产生5海里的一个距离圈
process(Rst, ClkTrgt, TrigOut)
variable cnt : integer range 0 to 16#FFFF#;
variable trigout_r : std_logic;
begin
if(Rst = '1') then
Ring5Nm <= '0';
cnt := 0;
elsif rising_edge(ClkTrgt) then
if((TrigOut = '1' and trigout_r = '0') or cnt = 16#FFFF#) then
cnt := 0;
end if;
if(cnt >= Range5Nm - LineHalfWidth and cnt <= Range5Nm + LineHalfWidth) then
Ring5Nm <= '1';
else
Ring5Nm <= '0';
end if;
cnt := cnt + 1;
trigout_r := TrigOut;
end if;
end process;
------------------------------------------------------------------------
------------------------------------------------------------------------
--仿真输出
-- TRIG_OUT_1K8 <= TrigOut_1k8;
-- TRIG_OUT_1K2 <= TrigOut_1k2;
-- TRIG_OUT_0K6 <= TrigOut_0k6;
-- TRIG_OUT_1K3 <= TrigOut_1k3;
-- TRIG_OUT_0K65 <= TrigOut_0k65;
TRIG_OUT <= TrigOut;
-- AZIP_OUT_216 <= AzipOut_216;
-- AZIP_OUT_360 <= AzipOut_360;
-- AZIP_OUT_1080 <= AzipOut_1080;
AZIP_OUT <= AzipOut;
HEAD_OUT <= ShfOut;
FIX_OUT_3V <= FixTrgt3vVideoOut;
FIX_OUT_0V5 <= FixTrgt05vVideoOut;
MOV_OUT_1 <= MovTrgt1VideoOut;
MOV_OUT_3 <= MovTrgt3VideoOut;
RING_5NM <= Ring5Nm;
ClkTrgt <= CLK_IN;
ClkTrig <= CLK_IN;
ClkAzip <= CLK_IN;
ClkShf <= CLK_IN;
Rst <= RST_IN;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -