(包括蜂鸣器Р 7段数码管Р )Р3.计算机Р四、功能模块Р1.分频器(div)Р将芯片上提供的50MHz的时钟分频为12MHz和8Hz的时钟,分别供计数器与分频驱动器(数控分频器)使用。Р(1)模块图形:Р(2)程序如下:Рreg [23:0] counter8Hz; Рreg [23:0] counter12MHz;Р Рalways @(negedge reset_l or posedge clk)begin //6MHz分频Р if (!reset_l) beginР counter6MHz <= 24'b0;Р clk_6m <= 1'b0;Р end Р else beginР if(counter12MHz==24'd4) begin Р Counter12MHz<=0;Р clk_12m<=~clk_12m; Р end Р else begin Р Counter12MHz<=Counter12MHz+1; Р end Р end Рend Рalways @(negedge reset_l or posedge clk) begin //4Hz分频Р if (!reset_l) beginР Counter8Hz <= 24'b0;Р clk_8hz <= 1'b0;Р end Р else begin Р if(Counter8Hz==24'd6519999) begin Р counter4Hz<=0;Р clk_8hz<=~clk_8hz; Р end Р else begin Р Counter8Hz<=Counter8Hz+1;Р end Р end Рend Р Р(3)仿真波形:Р仿真波形分析Р由波形可看出ckl为输入50MHz的时钟信号,ckl12输出为平12MHz的时钟信号,clk8为8Hz的时钟信号,由于纸张有限没有打印出其全部波形。