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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
请各位高手看看本人的程序,编译通过了,仿真却没有结果。我想实现的功能是单稳态脉冲展宽(通过外端口控制展宽宽度)。程序如下:" x9 }* A' ]5 ~! ?6 b8 Q6 i
计数器(控制展宽电路的宽度)部分:
$ C8 o0 D* ?( S( }library IEEE;
% Z  u, {& s7 U) ~( Y6 }use IEEE.STD_LOGIC_1164.ALL;% D/ I& G7 d+ Q! I4 v9 t, |6 B0 b- S
use IEEE.STD_LOGIC_ARITH.ALL;, ?# c9 }. r, Q; [
use IEEE.STD_LOGIC_UNSIGNED.ALL;
2 F) r* W7 o. a" M% ~1 W6 G% }entity counter is8 s; [5 }& o4 p/ W/ X
  port(reset,en,clk: in std_logic;
0 k, P8 ?5 }* W6 X* v       N1,N2,N3,N4: in std_logic;* R4 s' \6 V6 g
       feed_out: out std_logic);
' X+ q: U" d) ]1 \% @8 H  end counter;
) f5 z" ?, t3 j/ }8 D" Tarchitecture Behavioral of counter is
4 C2 _- X$ R. \8 |' {signal temp: integer range 0 to 15:=0;& c) U5 E3 B- \1 t
signal k:integer:=0;$ _" y1 T' O' g
begin
8 D+ x& h; A) M$ D8 i/ Y" I8 Rprocess(N1,N2,N3,N4,k,clk) is
( r: o2 v+ k6 v2 Rbegin
8 n# U$ i/ q/ `1 u0 g( P6 E+ B- G   if(N1='1') then temp<=temp+1;1 M- l: e! n- Y! ^6 R/ D
  elsif(N2='1') then temp<=temp+2;" [: ?  l- y4 h9 b0 \
  elsif(N3='1') then temp<=temp+4;
! w1 i8 @+ W, s  elsif(N4='1') then temp<=temp+8;
6 U1 f" N- x& w3 D- z7 f  else null;
. J8 j* l) A, ~  end if;; y$ o' @, ]2 w0 h, ]
  if (clk'event and clk='1') then8 @7 B8 h  B/ }, V! t4 k+ y6 i
    if (reset='1') then: f5 T4 e2 p9 a$ F7 J0 h% u
       k<=0;4 S- h) c5 G5 v+ W
     feed_out<='0';
( `, Z+ V& C+ h. i     elsif (en='1') then   8 U7 `0 l" _" ]; Z$ W  l
    if (k=temp-1) then
7 v* l+ d" O" ]( z9 P9 X' U         feed_out<='1';  ?" \8 d- Q6 [/ t4 H  C, s
         k<=temp-1;% e# p) s9 F" \& X
     else k<=k+1;( e9 L; ]% n  r4 {, r* q  M) H
    end if;0 J% a7 A$ u1 E' [0 C# e# E6 ]
    end if;2 |% i7 k: o9 o; n
end if;
  @6 ^& l1 H( k3 i1 c3 Qend process;
/ e( A% E; z; M% H0 z5 ]end Behavioral;
" V0 m: X$ q# d) l: i% tD触发器(脉冲前沿产生电路,又是展宽脉冲宽度形成电路):1 h- w+ T8 U7 M" S0 u$ w( l- ]
library IEEE;  ^  e7 o3 H7 s$ h4 v
use IEEE.STD_LOGIC_1164.ALL;1 j+ I7 M, y6 ]0 K" D+ v
use IEEE.STD_LOGIC_ARITH.ALL;
7 n+ R) G; p) cuse IEEE.STD_LOGIC_UNSIGNED.ALL;
4 T/ `  H# b7 \entity D_trigger is( |* T& v' U, R% Q  p: I' `
  port(D,clear: in std_logic;
9 F1 x6 ^# A4 C       clk: in std_logic;6 k! B5 @- g% M
   Q: out std_logic);
: T- t9 S' W2 }6 Q1 r( O, tend D_trigger;. G9 Z5 t; U6 J
architecture Behavioral of D_trigger is7 P7 T+ a8 @/ N
begin
1 f3 b5 e6 S7 ]( L- [. _; `8 Q0 rprocess(D,clear,clk) is
) m8 E3 N1 X! j4 ~/ Pbegin3 g. T2 Y# d  n! a0 C
  if (clear='1') then
9 O( ~; j$ J. r& L6 n    Q<='0';     
7 e9 D# b  l, _. O  elsif (clk'event and clk='1') then
0 p" I+ i* e) Z/ F8 l; M    Q<=D;& C9 p' p7 k. v" p# K
  end if;8 o$ h5 r( i+ p  i9 B+ X
end process;  
/ O2 D. k0 E7 \5 L; n5 ?7 Tend Behavioral;9 D6 k# Z& Z3 Q. l% X) e- K; ]: z
外部综合部分:
/ d5 O4 W: D0 O* s8 X6 klibrary IEEE;
3 R- v2 r9 [6 W: M/ I" z" ?use IEEE.STD_LOGIC_1164.ALL;
& j( g8 [2 |( n8 D% Luse IEEE.STD_LOGIC_ARITH.ALL;
" P$ u% `  V/ M  D, H3 g5 L% |use IEEE.STD_LOGIC_UNSIGNED.ALL;0 u* k, z/ ^' H
entity pulse_expand is
7 o7 Z  W' G4 X7 U2 P# p  port(pulse_in,D_in: in std_logic;8 H' c  W- y; L# ?# @- R
       clk_in: in std_logic;! `9 Z  A: c% [% V& `  w/ [
   n1,n2,n3,n4: in std_logic;6 ?8 H$ p3 g" G! ?* ]% J& d
   pulsewidth_out: out std_logic);
  L: o- E* T$ g. r. nend pulse_expand;: l: K0 R2 E) ^7 g* J; h( t% L( a
architecture Behavioral of pulse_expand is+ C5 K$ y1 L( s& l
signal a1,a2,a3: std_logic;
5 B! `8 b7 c  |( Z% fcomponent counter is
# g2 v& \" Z+ G6 U   port(reset,en,clk: in std_logic;  u! I( @1 ]& d! z; @! u+ r" A: r
      N1,N2,N3,N4: in std_logic;
0 Q, q/ G9 \- Q& l- S( o2 C        feed_out: out std_logic);
" p2 r, C: n0 }$ k2 f: A/ r  end component counter;
' z! R9 ^  i& u1 @& Y+ |/ y3 O/ T  component  D_trigger is
- p1 g/ g  M: O# i- i     port(D,clear: in std_logic;0 k+ V1 \6 ~- Q1 Q
          clk: in std_logic;/ F! b3 D: S) w% ?. {) G; t9 F* `
      Q: out std_logic);  T; M0 p& s/ F3 k* i+ ?- V
  end component D_trigger;5 |' J2 S9 c+ V( l' K% K
begin8 A# \" `  Q$ E2 S
P1: D_trigger port map (D=>D_in,clear=>a1,clk=>pulse_in,Q=>a2);
3 N0 G7 u) }5 @( @2 l: O9 R& w) Qa3<= not a2;
2 }8 W0 z/ b# R  s# \5 FP2: counter port map ( reset=>a3,en=>a2,clk=>clk_in,feed_out=>a1,
* v. p0 I# }# F- a! |- `    N1=>n1,N2=>n2,N3=>n3,N4=>n4);  B+ j7 {: ^) q% m+ w  ~  w0 J
pulsewidth_out<=a2;
" p1 p4 B8 _, k% M* V2 |end Behavioral;* H& }  S6 t3 I! Y# g0 W) h" Q& i3 Y% A, B

* D: c$ S$ U4 H) _' o( a[ 本帖最后由 marshal403006 于 2008-6-2 09:38 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-10-31 22:18 , Processed in 0.140625 second(s), 25 queries , Gzip On.

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

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

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