基于FPGA的交通灯课程设计报告

发布时间 : 星期四 文章基于FPGA的交通灯课程设计报告更新完毕开始阅读

电子技术课程设计报告

要有工程的进度安排。对于时间的规划其实是我们最欠缺的,记得在软件开发的课程中学到过利用甘特图来划定开发进度,但是实际中我们却完全没有按照它来实现。每次课程设计,大部分同学都是最后一段时间拼命赶,在验收的前几天还在通宵写代码。以前我也是这样,不过这次有所改善了,因为我大致规划了设计、实现和调试的时间,使得其他同学还在写程序进行仿真的时候,我已经开始了逐步的下载测试和修改完善工作,这为我在功能方面的完善提供了宝贵的时间。

要善于借鉴别人的想法。很多时候自己独立思考可以充分锻炼能力,但是汲取他人之所长会对自己的工作产生事倍功半的效果。但是借鉴要有限度,要讲究方式方法。很多同学容易走两个极端,一种是埋头编程,中途遇到很多困难其实前人也都遇到并且很好地解决了,但是他们还要继续重复地探寻解决途径;另一种是照单全收,完全不明白作者的用意和初衷,只知道看结果对就拿来用,没弄明白其所以然,显然是荒废了学习的机会。

五、附录

5.1主控制模块源程序

library ieee;

use ieee.std_logic_1164.all; entity jtdkz is

port(clk,sm,sb:in std_logic;

mr,my,mg,br,by,bg:out std_logic); end entity jtdkz;

architecture art of jtdkz is type state_type is(a,b,c,d); signal state:state_type; begin

cnt:process(clk)is

variable s:integer range 0 to 45; variable clr,en:bit; begin

if(clk'event and clk='1')then if clr='0'then s:=0; elsif en='0'then s:=s; else s:=s+1; end if;

case state is

when a=>mr<='0';my<='0';mg<='1'; br<='1';by<='0';bg<='0';

1 0

电子技术课程设计报告

if(sb and sm)='1'then if s=45 then

state<=b;clr:='0';en:='0'; else

state<=a;clr:='1';en:='1'; end if;

elsif(sb and(not sm))='1'then state<=b;clr:='0';en:='0'; else

state<=a;clr:='1';en:='1'; end if;

when b=>mr<='0';my<='1';mg<='0'; br<='1';by<='0';bg<='0'; if s=5 then

state<=c;clr:='0';en:='0'; else

state<=b;clr:='1';en:='1'; end if;

when c=>mr<='1';my<='0';mg<='0'; br<='0';by<='0';bg<='1'; if(sm and sb)='1' then if s=25 then

state<=d;clr:='0';en:='0'; else

state<=c;clr:='1';en:='1'; end if;

elsif sb='0' then

state<=d;clr:='0';en:='0'; else

state<=c;clr:='1';en:='1'; end if;

when d=>mr<='1';my<='0';mg<='0'; br<='0';by<='1';bg<='0'; if s=5 then

state<=a;clr:='0';en:='0'; else

state<=d;clr:='1';en:='1'; end if; end case; end if;

end process cnt;

end architecture art;

1 1

电子技术课程设计报告

5.2 45s模块源程序

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; --------------------------------------- entity time_45 is

port(sb,clk,en45:in std_logic; dout45m,dout45b:out std_logic_vector(7 downto 0)); end entity time_45;

--------------------------------------- architecture art of time_45 is

signal cnt6b:std_logic_vector(5 downto 0); begin process(sb,clk,en45)is begin if sb='0'then cnt6b<=cnt6b-cnt6b-1; elsif(clk'event and clk='1')then if en45='1' then cnt6b<=cnt6b+1; elsif en45='0'then cnt6b<=cnt6b-cnt6b-1; end if; end if; end process; process(cnt6b)is begin case cnt6b is when \ 50 when \ 49 when \ 48 when \ 47 when \ 46 when \ 45 when \ 44 when \ 43 when \ 42 when \ 41 when \ 40 when \ 39 when \ 38 when \ 37 when \ 36 when \ 35 when \ 34

1 2

电子技术课程设计报告

when \ 33 when \ 32 when \ 31 when \ 30 when \ 29 when \ 28 when \ 27 when \ 26 when \ 25 when \ 24 when \ 23 when \ 22 when \ 21 when \ 20 when \ 19 when \ 18 when \ 17 when \ 16 when \ 15 when \ 14 when \ 13 when \ 12 when \ 11 when \ 10 when \ 9 when \ 8 when \ 7 when \ 6 when others=>dout45m<=\ --0 0

end case; end process; end architecture art;

5.3 25s模块源程序

library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; ------------------------------------ entity time_25 is

port(sb,sm,clk,en25:in std_logic;

1 3

联系合同范文客服:xxxxx#qq.com(#替换为@)