用Verilog语言编写的多功能数字钟 下载本文

9

4'b0101: Led = 7'b1101_101; 4'b0110: Led = 7'b1111_101; 4'b0111: Led = 7'b0000_111; 4'b1000: Led = 7'b1111_111; 4'b1001: Led = 7'b1101_111; default: Led = 7'b0000_000; endcase if(SEL==3'b101) case(gewei1)

4'b0000: Led = 7'b0111_111; 4'b0001: Led = 7'b0000_110; 4'b0010: Led = 7'b1011_011; 4'b0011: Led = 7'b1001_111; 4'b0100: Led = 7'b1100_110; 4'b0101: Led = 7'b1101_101; 4'b0110: Led = 7'b1111_101; 4'b0111: Led = 7'b0000_111; 4'b1000: Led = 7'b1111_111; 4'b1001: Led = 7'b1101_111; default: Led = 7'b0000_000; endcase if(SEL==3'b100) Led=7'b1000_000; if(SEL==3'b011) case(shiwei2)

4'b0000: Led = 7'b0111_111; 4'b0001: Led = 7'b0000_110; 4'b0010: Led = 7'b1011_011; 4'b0011: Led = 7'b1001_111; 4'b0100: Led = 7'b1100_110; 4'b0101: Led = 7'b1101_101; 4'b0110: Led = 7'b1111_101; 4'b0111: Led = 7'b0000_111; 4'b1000: Led = 7'b1111_111; 4'b1001: Led = 7'b1101_111; default: Led = 7'b0000_000; endcase if(SEL==3'b010) case(gewei2)

4'b0000: Led = 7'b0111_111; 4'b0001: Led = 7'b0000_110; 4'b0010: Led = 7'b1011_011; 4'b0011: Led = 7'b1001_111; 4'b0100: Led = 7'b1100_110;

4'b0101: Led = 7'b1101_101; 4'b0110: Led = 7'b1111_101; 4'b0111: Led = 7'b0000_111; 4'b1000: Led = 7'b1111_111; 4'b1001: Led = 7'b1101_111; default: Led = 7'b0000_000; endcase if(SEL==3'b001) Led=7'b1000_000; if(SEL==3'b000) case(shiwei3)

4'b0000: 4'b0001: 4'b0010: 4'b0011: 4'b0100: 4'b0101: 4'b0110: 4'b0111: 4'b1000: 4'b1001: default: endcase

if(SEL==3'b111) case(gewei3) 4'b0000: 4'b0001: 4'b0010: 4'b0011: 4'b0100: 4'b0101: 4'b0110: 4'b0111: 4'b1000: 4'b1001: default: endcase SEL = SEL + 3'd1; end assign LEDAG=Led; endmodule

10

Led = 7'b0111_111; Led = 7'b0000_110; Led = 7'b1011_011; Led = 7'b1001_111; Led = 7'b1100_110; Led = 7'b1101_101; Led = 7'b1111_101; Led = 7'b0000_111; Led = 7'b1111_111; Led = 7'b1101_111; Led = 7'b0000_000; Led = 7'b0111_111; Led = 7'b0000_110; Led = 7'b1011_011; Led = 7'b1001_111; Led = 7'b1100_110; Led = 7'b1101_101; Led = 7'b1111_101; Led = 7'b0000_111; Led = 7'b1111_111; Led = 7'b1101_111; Led = 7'b0000_000;

四. 总结体会

这次课程设计虽然只有短短的四天,但我的收获却很大。通过这次实习,我掌握了EDA设计的基本流程(即设计输入—编译—调试—仿真—下载),领会了自顶而下结构化设计的优点,并具备了初步的EDA程序设计能力。 我感觉,这个程序最难的地方在于顶层模块的设计,因为顶层模块需要将各个子模块按照电路原理有机地结合起来,这需要扎实的理论功底,而这正是我所欠缺的。相比而言,子模块的设计就容易多了,因为Verilog语言和C语言有很多相似之处,只要明白了实验原理,就不难完成,水平的高下只体现在程序的简洁与否。Verilog源程序的编写很容易出现错误,这就需要耐心的调试。因为很多情况下,一长串的错误往往是由一个不经意的小错误引起的。当程序屡调屡错的时候,最好和其他同学沟通交流一下,他们不经意的一句话,就可能给我启发,使问题迎刃而解。 这次实习,给我感触最深的还是行为态度问题。人的能力有大有小,

但只要端正态度,不抛弃,不放弃,任何人都能取得令自己满意的成绩。在此,我由衷的感谢在这次课程设计中给了我巨大帮助的老师和同学们!

11