求一个基于Verilog HDL的音乐播放代码

作者&投稿:柘温 (若有异议请与网页底部的电邮联系)
Verilog hdl蜂鸣器音乐,求一软件,能把音乐转换成代码的~

音乐转换成代码???哪里有啊,一般蜂鸣器都是根据响的时间不同来代表音乐的1234567.

我记得之前写过一个抢答器,还能计时。加分。减分啥的我回去给你看看还在不

module song(clk500khz,clk4hz,speaker);
input clk500khz,clk4hz;
output speaker;
reg[11:0] divider,origin;
reg[7:0] counter;
reg[7:0] note;//音符索引值
wire carry;
//可控分频器
assign carry=(divuder==4095);
always@(posedge clk500khz)
begin
if(carry)
divider=origin;
else
divider=divider+1;
end
//二分频整型
always@(posedge carry)
begin
speaker=~speaker;
end
//由音符索引查可控分频器预置值表
always@(posedge clk4hz)
begin
case(note)//分频比预置
4'b0000:origin=16384;//休止
4'b0001:origin=616;//低音1
4'b0010:origin=773;//低音2
4'b0011:origin=912;//低音3
4'b0100:origin=976;//低音4
4'b0101:origin=1092;//低音5
4'b0110:origin=1197;//低音6
4'b0111:origin=1296;//低音7
4'b1000:origin=1372;//中音1
4'b1001:origin=1410;//中音2
4'b1010:origin=1480;//中音3
4'b1011:origin=1512;//中音4
4'b1100:origin=1570;//中音5
4'b1101:origin=1622;//中音6
4'b1110:origin=1668;//中音7
4'b1111:origin=1690;//高音1
endcase
end
//乐谱查找表
always@(posedge clk4hz)
begin
if(counter==63)
counter=0;
else
counter=counter+1;
case(counter)
0:note='b0011;//乐谱 低音3
1:note='b0011;//乐谱 低音3
2:note='b0011;//乐谱 低音3
3:note='b0011;//乐谱 低音3
4:note='b0101;//乐谱 低音5
6:note='b0110;//乐谱 低音6
7:note='b1000;//乐谱 中音1
8:note='b1000;//乐谱 中音1
9:note='1001b;//乐谱 中音2
……………………
……………………
60:note='b0100;
61:note='b0100;
62:note='b0100;
63:note='b0100;
endcase
end
endmodule


崇礼县17143359340: 求一个基于Verilog HDL的音乐播放代码 -
苍聪海卡: module song(clk500khz,clk4hz,speaker); input clk500khz,clk4hz; output speaker; reg[11:0] divider,origin; reg[7:0] counter; reg[7:0] note;//音符索引值 wire carry;//可控分频器 assign carry=(divuder==4095); always@(posedge clk500khz) begin if(...

崇礼县17143359340: 高分求一用Verilog HDL语言编写的简单交通灯程序 -
苍聪海卡: 展开全部//绿灯亮40秒,转黄灯;//黄灯亮5秒,转左转灯;//左转灯亮15秒,转黄灯;//黄灯亮5秒,转红灯;//红灯亮55秒,转绿灯;//lamp从高到低 分别接红灯 黄灯 绿灯 左转灯//account接2个数码管 module traffic(clk,en,lamp,acount); output[7:0] ...

崇礼县17143359340: 用verilog hdl语言编写一个8—3译码器程序 -
苍聪海卡: 首先要纠正一下,相对多的输入转化成为相对少的输出,一般叫编码器;相对少的输入转化成为相对多的输出,一般叫译码器.所以,确切地说你要做的应该是8-3编码器(还是3-8译码器). //8-3编码器verilog代码 module enc_83(datain, ...

崇礼县17143359340: 用Verilog HDL语言设计一个9分频器 -
苍聪海卡: N倍奇数分频器(Verilog) 修改参数N和cnt_p,cnt_n的位宽,可以实现奇数N的分频.module N_odd_divider ( input i_clk, input rst_n, output o_clk );parameter N = 9;parameter M = N>>1;// bit_of_N: N_odd的二进制位宽 reg [3:0] cnt_p; //上升...

崇礼县17143359340: 求大神帮忙用verilog hdl写一个程序 -
苍聪海卡: module canlender(a,b,option1,option2,option3,option4,led_result); inpput [9:0] a; input [9:0] b; //以1023以内的加减乘除举例 input option1,option2,option3,option4; //四个按键,低电有效 //数字也不是这么表达的,而是每个按键对应一个数字,...

崇礼县17143359340: 用verilog hdl语言设计一个9人表决器,五个人通过 -
苍聪海卡: module voter9(pass,vote);output pass;input[8:0] vote;reg[3:0] sum;integer i;reg pass;always @(vote)begin sum=0;for(i=0;i<=8;i=i+1) //for 语句if(vote[i]) sum=sum+1;if(sum>4'b0100) pass=1; //若超过 4 人赞成,则 pass=1else pass=0;end endmodule

崇礼县17143359340: 急求用Verilog HDL编写的4位乘法器程序 -
苍聪海卡: module mult(x,y,out); input [3:0] x; input [3:0] y; output [7:0] out; assign out=x*y; endmodule

崇礼县17143359340: 用Verilog hdl设计一个实现8位ALU功能的函数其输入为两个4位操作变量a和b,以及一个3位选择信号select,输出为5位变量out,具体关系见下表.不考虑计算... -
苍聪海卡:[答案] 给你个参考,没有的功能自己想吧,这些很简单. module alu ( input [2:0] a, input [2:0] b, input [2:0] sel, output reg [7:0] y ); always@(a or b or sel) begin case(sel) 3'b000:y = a + b; 3'b001:y = a - b; 3'b010:y = a * b; 3'b011:begin y[7:4] = a / b; y[3:0] = a % ...

崇礼县17143359340: 基于verilog HDL 语言的带有同步输出进位或借位的可逆16位计数器 -
苍聪海卡: 我写的一个十进制计数,可以复位,置数,使能,双向计数,请参考`timescale1ns/100psmodulecount(clk,nrst,ncs,s,load,load_data,q);inputclk;inputnrst;inputncs;inputs;inputload;input[3:0]load_data;output[3:0]q;reg[3:0]q;always@(...

崇礼县17143359340: 求用Verilog Hdl程序编写个计时5秒的计时器... -
苍聪海卡: always@ (posedge clk or negedge rst) if(rst) begin s5<=0 ; count<=0 ;end elsebeginif(count<n) begin count<=count+1; s5<=0; end else begin s5<=1; count<=0; end 这是一段最简单易理解的代码,不过需要选择一个合适CLK ,然后给N赋值,最终通过数CLK多少周期输出5S计时信号;例如clk如果为100Mhz,它的周期是10ns,此时需要500000000个计数周期,输出一个S5的上升沿脉冲,表示5S计时到.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网