找回密码
 注册
关于网站域名变更的通知
查看: 1695|回复: 0
打印 上一主题 下一主题

基于FPGA的单稳态脉冲展宽电路的设计问题!

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-6-1 23:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
请各位高手看看本人的程序,编译通过了,仿真却没有结果。我想实现的功能是单稳态脉冲展宽(通过外端口控制展宽宽度)。程序如下:
: S  n' M: Y- f( p: s6 r8 I! B计数器(控制展宽电路的宽度)部分:5 a. {6 }5 @& A4 {' M8 }
library IEEE;
3 O4 I) f# X3 s8 ^: k- duse IEEE.STD_LOGIC_1164.ALL;5 @7 v5 c0 B0 Z+ g
use IEEE.STD_LOGIC_ARITH.ALL;# b, Z' K6 g! ?" P; ~
use IEEE.STD_LOGIC_UNSIGNED.ALL;3 d1 S% E; U  q, v0 w
entity counter is
. P3 P7 {8 I7 m; U! V. [6 l  port(reset,en,clk: in std_logic;' W, A" \  P2 |. C0 I( H
       N1,N2,N3,N4: in std_logic;
0 @0 ^. R) y5 Y9 |' \- n$ f       feed_out: out std_logic);
; Q. H) h. z( }8 B5 Z' K) E) S: I  end counter;7 I- V  D9 W9 \" u8 D
architecture Behavioral of counter is  @3 U/ h4 i" n) L2 Y, E
signal temp: integer range 0 to 15:=0;. r8 }: {6 i- Y' [  j2 `( c
signal k:integer:=0;
8 E% a0 y# z& ?2 G2 Wbegin
$ H6 b% C# }  P1 x+ ?- j! Tprocess(N1,N2,N3,N4,k,clk) is
  B9 T; U7 r. ]9 jbegin
" E' o: E  M0 G+ u, C/ {6 F   if(N1='1') then temp<=temp+1;
9 k3 |, {& a  {. c9 z8 \5 L/ X  elsif(N2='1') then temp<=temp+2;
" n# X* \) w; l3 r& r5 m$ {' }# x  elsif(N3='1') then temp<=temp+4;
$ v" Q4 E$ D! d  u' Q% ~  elsif(N4='1') then temp<=temp+8;
5 X: @. K% L, m: N6 O  else null;
) \3 }* A6 z2 b( Z; W: q& m  end if;# R) G6 c' }& z
  if (clk'event and clk='1') then- d6 b- M8 a" F: I' P  _) ]
    if (reset='1') then4 x+ L$ `" D8 a' s6 i% j
       k<=0;" ^! U  z$ l+ F4 ]
     feed_out<='0';; }$ u; b) S5 q: j( i) \/ a
     elsif (en='1') then   
4 y: [5 l9 T& o  N    if (k=temp-1) then
# o' G' n: }2 v8 e2 i         feed_out<='1';0 n  n- e; H. f- F
         k<=temp-1;
# f9 J6 r7 D/ N     else k<=k+1;
) i( ]$ b5 \" J) O+ F    end if;
; {2 \! v7 x( J, v: H6 g& G    end if;
- \1 s' g$ _& R3 kend if;" p# v( U( ?1 R, X( z/ R
end process;
4 j' D7 `0 V9 oend Behavioral;' L1 w9 k# k/ J, E* L3 G  p/ c! f
D触发器(脉冲前沿产生电路,又是展宽脉冲宽度形成电路):: B, G3 v  B1 g! l$ C
library IEEE;
7 {4 a  `# {5 `; _: Duse IEEE.STD_LOGIC_1164.ALL;( N: q0 Y* |  w& o
use IEEE.STD_LOGIC_ARITH.ALL;0 l. T1 H2 {4 x5 P; y- o& R
use IEEE.STD_LOGIC_UNSIGNED.ALL;
* O0 L2 @9 F! G, y9 W' nentity D_trigger is
: ?# ]! @+ e- {# G: ^7 V. P) ~  port(D,clear: in std_logic;
4 u. n$ _' Y* i       clk: in std_logic;- t2 ?/ u1 x9 X, C8 o
   Q: out std_logic);
, b. m- k0 Y! a, _7 {- Uend D_trigger;
0 I) @. _# v+ J4 d1 ?3 V6 n) V9 J  @architecture Behavioral of D_trigger is
( G" [; S) i* B$ C0 Z/ H# Dbegin
% p1 E2 j  P% x$ t# T9 U2 _# C6 Wprocess(D,clear,clk) is
5 v0 d% @$ J& Y+ s1 e' ^7 Y) bbegin
, g$ s9 n+ S+ P& m& G+ L  if (clear='1') then; O7 M7 Y2 }! R
    Q<='0';     : T) e& E; A% N4 k$ m3 [& r$ K. v
  elsif (clk'event and clk='1') then( R3 I5 O* T, U: y
    Q<=D;
' G& ?+ z" G5 n3 e* q$ l  end if;( O) F* N, ]1 p, U; U
end process;  
$ E: E9 |# `5 g0 s6 Cend Behavioral;4 e0 U* R$ Q: A7 b$ o1 a
外部综合部分:# S- a3 k  i* |2 d9 a6 \
library IEEE;+ _/ C2 v7 C7 Y9 l
use IEEE.STD_LOGIC_1164.ALL;
* P! k( ^* e! E8 S- @: F# M( |use IEEE.STD_LOGIC_ARITH.ALL;' }% P6 q% m" ]( G
use IEEE.STD_LOGIC_UNSIGNED.ALL;
4 h) k. @; t" F8 _% q0 |# j- ^# wentity pulse_expand is
9 b9 r7 [2 {- h5 }  port(pulse_in,D_in: in std_logic;# M% B3 f8 J: }: X! H( j
       clk_in: in std_logic;- d0 p1 a! \+ E8 j
   n1,n2,n3,n4: in std_logic;
/ y/ k9 Q3 \6 Q; J. N   pulsewidth_out: out std_logic);5 F$ u/ \6 I. P
end pulse_expand;* p8 }# b, K/ h$ G3 A! t8 O( T9 v
architecture Behavioral of pulse_expand is
2 d+ M) L6 m2 K7 Isignal a1,a2,a3: std_logic;. r+ [, ?: ^! ?$ L9 D+ g
component counter is
! x) o8 W: B: G$ P, k   port(reset,en,clk: in std_logic;0 T) u6 _0 I3 [) G1 c+ M. S+ A
      N1,N2,N3,N4: in std_logic;5 D; Q2 v9 Q/ p5 X. S# x
        feed_out: out std_logic);2 ~" N" i, V9 n* {" t. A
  end component counter;  V% ]" J9 f2 T% R  |7 D
  component  D_trigger is2 _: v- G3 l$ r7 ~
     port(D,clear: in std_logic;
/ C' m6 r# n  s+ Z1 V! Q          clk: in std_logic;
3 \$ S. [# B2 q# i! i4 ^" ?2 X      Q: out std_logic);
/ q$ n: X1 J% A: G8 Z4 F  end component D_trigger;
) G/ {/ N  r( S" U' Q3 cbegin( ]. g& Y8 {0 h: T
P1: D_trigger port map (D=>D_in,clear=>a1,clk=>pulse_in,Q=>a2);
) `" j2 A3 Y1 x8 K) T' }a3<= not a2;
. r- m! x' f" VP2: counter port map ( reset=>a3,en=>a2,clk=>clk_in,feed_out=>a1,- R4 W: p* C) P& f0 y8 B/ N4 L
    N1=>n1,N2=>n2,N3=>n3,N4=>n4);$ Z  f+ g% q) M' R
pulsewidth_out<=a2;
6 {, t2 Z7 a  o+ @4 d! \: {6 f* Lend Behavioral;
9 }) ]9 K3 O- \6 w& W
7 O6 U# N% b: @1 v* s[ 本帖最后由 marshal403006 于 2008-6-2 09:38 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-8-21 01:48 , Processed in 0.109375 second(s), 24 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表