Page 385 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 385
reg [27:0]note[42:0]; // 박자 변수
reg [27:0]play_time=0,sound_cnt=0;
parameter [27:0]tempo=54000000*0.05; //기본 박자
// 음계 선언
parameter G_L=54000000/2/195.997; //솔
parameter A_L=54000000/2/220.000; //라
parameter B_L=54000000/2/246.941; //도
parameter C=54000000/2/261.625; //도
parameter D=54000000/2/293.664; //레
parameter E=54000000/2/329.627; //미
parameter G=54000000/2/391.995; //솔
parameter rest=0;
// 박자 선언
parameter N8=tempo*4; //8분음표
parameter N4=tempo*8; //4분음표
parameter N2=tempo*16; //2분음표
parameter R4=tempo*8; //4분쉼표
parameter R48=540000; //같은음쉼표
// 음계 순서 선언
initial
begin
scale[0]=G_L; note[0]=N8;
scale[1]=rest; note[1]=R48;
scale[2]=G_L; note[2]=N8;
scale[3]=C; note[3]=N8;
scale[4]=D; note[4]=N8;
scale[5]=E; note[5]=N8;
scale[6]=D; note[6]=N8;
scale[7]=C; note[7]=N4;
scale[8]=A_L; note[8]=N8;
scale[9]=rest; note[9]=R48;
scale[10]=A_L; note[10]=N8;
scale[11]=C; note[11]=N8;
scale[12]=rest; note[12]=R48;
scale[13]=C; note[13]=N8;
scale[14]=G_L; note[14]=N4;
scale[15]=rest; note[15]=R4;
- 378 -