data/full_repos/permissive/165873996/src/modified/playnote.v
1: b'%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:237: Implicit conversion of real to integer\n  0:   clkdivider = C0_divider;\n                    ^~~~~~~~~~\n                  ... Use "/* verilator lint_off REALCVT */" and lint_on around source to disable this message.\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:238: Implicit conversion of real to integer\n  1:   clkdivider = Cd0_Db0_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:239: Implicit conversion of real to integer\n  2:   clkdivider = D0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:240: Implicit conversion of real to integer\n  3:   clkdivider = Dd0_Eb0_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:241: Implicit conversion of real to integer\n  4:   clkdivider = E0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:242: Implicit conversion of real to integer\n  5:   clkdivider = F0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:243: Implicit conversion of real to integer\n  6:   clkdivider = Fd0_Gb0_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:244: Implicit conversion of real to integer\n  7:   clkdivider = G0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:245: Implicit conversion of real to integer\n  8:   clkdivider = Gd0_Ab0_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:246: Implicit conversion of real to integer\n  9:   clkdivider = A0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:247: Implicit conversion of real to integer\n  10:  clkdivider = Ad0_Bb0_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:248: Implicit conversion of real to integer\n  11:  clkdivider = B0_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:249: Implicit conversion of real to integer\n  12:  clkdivider = C1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:250: Implicit conversion of real to integer\n  13:  clkdivider = Cd1_Db1_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:251: Implicit conversion of real to integer\n  14:  clkdivider = D1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:252: Implicit conversion of real to integer\n  15:  clkdivider = Dd1_Eb1_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:253: Implicit conversion of real to integer\n  16:  clkdivider = E1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:254: Implicit conversion of real to integer\n  17:  clkdivider = F1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:255: Implicit conversion of real to integer\n  18:  clkdivider = Fd1_Gb1_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:256: Implicit conversion of real to integer\n  19:  clkdivider = G1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:257: Implicit conversion of real to integer\n  20:  clkdivider = Gd1_Ab1_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:258: Implicit conversion of real to integer\n  21:  clkdivider = A1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:259: Implicit conversion of real to integer\n  22:  clkdivider = Ad1_Bb1_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:260: Implicit conversion of real to integer\n  23:  clkdivider = B1_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:261: Implicit conversion of real to integer\n  24:  clkdivider = C2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:262: Implicit conversion of real to integer\n  25:  clkdivider = Cd2_Db2_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:263: Implicit conversion of real to integer\n  26:  clkdivider = D2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:264: Implicit conversion of real to integer\n  27:  clkdivider = Dd2_Eb2_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:265: Implicit conversion of real to integer\n  28:  clkdivider = E2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:266: Implicit conversion of real to integer\n  29:  clkdivider = F2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:267: Implicit conversion of real to integer\n  30:  clkdivider = Fd2_Gb2_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:268: Implicit conversion of real to integer\n  31:  clkdivider = G2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:269: Implicit conversion of real to integer\n  32:  clkdivider = Gd2_Ab2_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:270: Implicit conversion of real to integer\n  33:  clkdivider = A2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:271: Implicit conversion of real to integer\n  34:  clkdivider = Ad2_Bb2_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:272: Implicit conversion of real to integer\n  35:  clkdivider = B2_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:273: Implicit conversion of real to integer\n  36:  clkdivider = C3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:274: Implicit conversion of real to integer\n  37:  clkdivider = Cd3_Db3_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:275: Implicit conversion of real to integer\n  38:  clkdivider = D3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:276: Implicit conversion of real to integer\n  39:  clkdivider = Dd3_Eb3_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:277: Implicit conversion of real to integer\n  40:  clkdivider = E3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:278: Implicit conversion of real to integer\n  41:  clkdivider = F3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:279: Implicit conversion of real to integer\n  42:  clkdivider = Fd3_Gb3_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:280: Implicit conversion of real to integer\n  43:  clkdivider = G3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:281: Implicit conversion of real to integer\n  44:  clkdivider = Gd3_Ab3_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:282: Implicit conversion of real to integer\n  45:  clkdivider = A3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:283: Implicit conversion of real to integer\n  46:  clkdivider = Ad3_Bb3_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:284: Implicit conversion of real to integer\n  47:  clkdivider = B3_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:285: Implicit conversion of real to integer\n  48:  clkdivider = C4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:286: Implicit conversion of real to integer\n  49:  clkdivider = Cd4_Db4_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:287: Implicit conversion of real to integer\n  50:  clkdivider = D4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:288: Implicit conversion of real to integer\n  51:  clkdivider = Dd4_Eb4_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:289: Implicit conversion of real to integer\n  52:  clkdivider = E4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:290: Implicit conversion of real to integer\n  53:  clkdivider = F4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:291: Implicit conversion of real to integer\n  54:  clkdivider = Fd4_Gb4_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:292: Implicit conversion of real to integer\n  55:  clkdivider = G4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:293: Implicit conversion of real to integer\n  56:  clkdivider = Gd4_Ab4_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:294: Implicit conversion of real to integer\n  57:  clkdivider = A4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:295: Implicit conversion of real to integer\n  58:  clkdivider = Ad4_Bb4_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:296: Implicit conversion of real to integer\n  59:  clkdivider = B4_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:297: Implicit conversion of real to integer\n  60:  clkdivider = C5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:298: Implicit conversion of real to integer\n  61:  clkdivider = Cd5_Db5_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:299: Implicit conversion of real to integer\n  62:  clkdivider = D5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:300: Implicit conversion of real to integer\n  63:  clkdivider = Dd5_Eb5_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:301: Implicit conversion of real to integer\n  64:  clkdivider = E5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:302: Implicit conversion of real to integer\n  65:  clkdivider = F5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:303: Implicit conversion of real to integer\n  66:  clkdivider = Fd5_Gb5_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:304: Implicit conversion of real to integer\n  67:  clkdivider = G5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:305: Implicit conversion of real to integer\n  68:  clkdivider = Gd5_Ab5_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:306: Implicit conversion of real to integer\n  69:  clkdivider = A5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:307: Implicit conversion of real to integer\n  70:  clkdivider = Ad5_Bb5_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:308: Implicit conversion of real to integer\n  71:  clkdivider = B5_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:309: Implicit conversion of real to integer\n  72:  clkdivider = C6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:310: Implicit conversion of real to integer\n  73:  clkdivider = Cd6_Db6_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:311: Implicit conversion of real to integer\n  74:  clkdivider = D6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:312: Implicit conversion of real to integer\n  75:  clkdivider = Dd6_Eb6_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:313: Implicit conversion of real to integer\n  76:  clkdivider = E6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:314: Implicit conversion of real to integer\n  77:  clkdivider = F6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:315: Implicit conversion of real to integer\n  78:  clkdivider = Fd6_Gb6_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:316: Implicit conversion of real to integer\n  79:  clkdivider = G6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:317: Implicit conversion of real to integer\n  80:  clkdivider = Gd6_Ab6_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:318: Implicit conversion of real to integer\n  81:  clkdivider = A6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:319: Implicit conversion of real to integer\n  82:  clkdivider = Ad6_Bb6_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:320: Implicit conversion of real to integer\n  83:  clkdivider = B6_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:321: Implicit conversion of real to integer\n  84:  clkdivider = C7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:322: Implicit conversion of real to integer\n  85:  clkdivider = Cd7_Db7_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:323: Implicit conversion of real to integer\n  86:  clkdivider = D7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:324: Implicit conversion of real to integer\n  87:  clkdivider = Dd7_Eb7_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:325: Implicit conversion of real to integer\n  88:  clkdivider = E7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:326: Implicit conversion of real to integer\n  89:  clkdivider = F7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:327: Implicit conversion of real to integer\n  90:  clkdivider = Fd7_Gb7_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:328: Implicit conversion of real to integer\n  91:  clkdivider = G7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:329: Implicit conversion of real to integer\n  92:  clkdivider = Gd7_Ab7_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:330: Implicit conversion of real to integer\n  93:  clkdivider = A7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:331: Implicit conversion of real to integer\n  94:  clkdivider = Ad7_Bb7_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:332: Implicit conversion of real to integer\n  95:  clkdivider = B7_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:333: Implicit conversion of real to integer\n  96:  clkdivider = C8_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:334: Implicit conversion of real to integer\n  97:  clkdivider = Cd8_Db8_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:335: Implicit conversion of real to integer\n  98:  clkdivider = D8_divider;  \n                    ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:336: Implicit conversion of real to integer\n  99:  clkdivider = Dd8_Eb8_divider;\n                    ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:337: Implicit conversion of real to integer\n  100:  clkdivider = E8_divider;  \n                     ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:338: Implicit conversion of real to integer\n  101:  clkdivider = F8_divider;  \n                     ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:339: Implicit conversion of real to integer\n  102:  clkdivider = Fd8_Gb8_divider;\n                     ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:340: Implicit conversion of real to integer\n  103:  clkdivider = G8_divider;  \n                     ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:341: Implicit conversion of real to integer\n  104:  clkdivider = Gd8_Ab8_divider;\n                     ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:342: Implicit conversion of real to integer\n  105:  clkdivider = A8_divider;  \n                     ^~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:343: Implicit conversion of real to integer\n  106:  clkdivider = Ad8_Bb8_divider;\n                     ^~~~~~~~~~~~~~~\n%Warning-REALCVT: data/full_repos/permissive/165873996/src/modified/playnote.v:344: Implicit conversion of real to integer\n  107:  clkdivider = B8_divider;\n                     ^~~~~~~~~~\n%Error: Exiting due to 108 warning(s)\n'
module playnote(
	input clk,
	input wire [6:0] note,
	input out_enable,
	output reg speaker
);
















































































































localparam base_clock_frequency = 10000000;
localparam C0_divider = base_clock_frequency			/ 16.35 / 2 - 1;
localparam Cd0_Db0_divider = base_clock_frequency	/ 17.32 / 2 - 1;
localparam D0_divider = base_clock_frequency			/ 18.35 / 2 - 1;
localparam Dd0_Eb0_divider = base_clock_frequency	/ 19.45 / 2 - 1;
localparam E0_divider = base_clock_frequency			/ 20.60 / 2 - 1;
localparam F0_divider = base_clock_frequency			/ 21.83 / 2 - 1;
localparam Fd0_Gb0_divider = base_clock_frequency	/ 23.12 / 2 - 1;
localparam G0_divider = base_clock_frequency			/ 24.50 / 2 - 1;
localparam Gd0_Ab0_divider = base_clock_frequency	/ 25.96 / 2 - 1;
localparam A0_divider = base_clock_frequency			/ 27.50 / 2 - 1;
localparam Ad0_Bb0_divider = base_clock_frequency	/ 29.14 / 2 - 1;
localparam B0_divider = base_clock_frequency			/ 30.87 / 2 - 1;
localparam C1_divider = base_clock_frequency			/ 32.70 / 2 - 1;
localparam Cd1_Db1_divider = base_clock_frequency	/ 34.65 / 2 - 1;
localparam D1_divider = base_clock_frequency			/ 36.71 / 2 - 1;
localparam Dd1_Eb1_divider = base_clock_frequency	/ 38.89 / 2 - 1;
localparam E1_divider = base_clock_frequency			/ 41.20 / 2 - 1;
localparam F1_divider = base_clock_frequency			/ 43.65 / 2 - 1;
localparam Fd1_Gb1_divider = base_clock_frequency	/ 46.25 / 2 - 1;
localparam G1_divider = base_clock_frequency			/ 49.00 / 2 - 1;
localparam Gd1_Ab1_divider = base_clock_frequency	/ 51.91 / 2 - 1;
localparam A1_divider = base_clock_frequency			/ 55.00 / 2 - 1;
localparam Ad1_Bb1_divider = base_clock_frequency	/ 58.27 / 2 - 1;
localparam B1_divider = base_clock_frequency			/ 61.74 / 2 - 1;
localparam C2_divider = base_clock_frequency			/ 65.41 / 2 - 1;
localparam Cd2_Db2_divider = base_clock_frequency	/ 69.30 / 2 - 1;
localparam D2_divider = base_clock_frequency			/ 73.42 / 2 - 1;
localparam Dd2_Eb2_divider = base_clock_frequency	/ 77.78 / 2 - 1;
localparam E2_divider = base_clock_frequency			/ 82.41 / 2 - 1;
localparam F2_divider = base_clock_frequency			/ 87.31 / 2 - 1;
localparam Fd2_Gb2_divider = base_clock_frequency	/ 92.50 / 2 - 1;
localparam G2_divider = base_clock_frequency			/ 98.00 / 2 - 1;
localparam Gd2_Ab2_divider = base_clock_frequency	/ 103.83 / 2 - 1;
localparam A2_divider = base_clock_frequency			/ 110.00 / 2 - 1;
localparam Ad2_Bb2_divider = base_clock_frequency	/ 116.54 / 2 - 1;
localparam B2_divider = base_clock_frequency			/ 123.47 / 2 - 1;
localparam C3_divider = base_clock_frequency			/ 130.81 / 2 - 1;
localparam Cd3_Db3_divider = base_clock_frequency	/ 138.59 / 2 - 1;
localparam D3_divider = base_clock_frequency			/ 146.83 / 2 - 1;
localparam Dd3_Eb3_divider = base_clock_frequency	/ 155.56 / 2 - 1;
localparam E3_divider = base_clock_frequency			/ 164.81 / 2 - 1;
localparam F3_divider = base_clock_frequency			/ 174.61 / 2 - 1;
localparam Fd3_Gb3_divider = base_clock_frequency	/ 185.00 / 2 - 1;
localparam G3_divider = base_clock_frequency			/ 196.00 / 2 - 1;
localparam Gd3_Ab3_divider = base_clock_frequency	/ 207.65 / 2 - 1;
localparam A3_divider = base_clock_frequency			/ 220.00 / 2 - 1;
localparam Ad3_Bb3_divider = base_clock_frequency	/ 233.08 / 2 - 1;
localparam B3_divider = base_clock_frequency			/ 246.94 / 2 - 1;
localparam C4_divider = base_clock_frequency			/ 261.63 / 2 - 1;
localparam Cd4_Db4_divider = base_clock_frequency	/ 277.18 / 2 - 1;
localparam D4_divider = base_clock_frequency			/ 293.66 / 2 - 1;
localparam Dd4_Eb4_divider = base_clock_frequency	/ 311.13 / 2 - 1;
localparam E4_divider = base_clock_frequency			/ 329.63 / 2 - 1;
localparam F4_divider = base_clock_frequency			/ 349.23 / 2 - 1;
localparam Fd4_Gb4_divider = base_clock_frequency	/ 369.99 / 2 - 1;
localparam G4_divider = base_clock_frequency			/ 392.00 / 2 - 1;
localparam Gd4_Ab4_divider = base_clock_frequency	/ 415.30 / 2 - 1;
localparam A4_divider = base_clock_frequency			/ 440.00 / 2 - 1;
localparam Ad4_Bb4_divider = base_clock_frequency	/ 466.16 / 2 - 1;
localparam B4_divider = base_clock_frequency			/ 493.88 / 2 - 1;
localparam C5_divider = base_clock_frequency			/ 523.25 / 2 - 1;
localparam Cd5_Db5_divider = base_clock_frequency	/ 554.37 / 2 - 1;
localparam D5_divider = base_clock_frequency			/ 587.33 / 2 - 1;
localparam Dd5_Eb5_divider = base_clock_frequency	/ 622.25 / 2 - 1;
localparam E5_divider = base_clock_frequency			/ 659.25 / 2 - 1;
localparam F5_divider = base_clock_frequency			/ 698.46 / 2 - 1;
localparam Fd5_Gb5_divider = base_clock_frequency	/ 739.99 / 2 - 1;
localparam G5_divider = base_clock_frequency			/ 783.99 / 2 - 1;
localparam Gd5_Ab5_divider = base_clock_frequency	/ 830.61 / 2 - 1;
localparam A5_divider = base_clock_frequency			/ 880.00 / 2 - 1;
localparam Ad5_Bb5_divider = base_clock_frequency	/ 932.33 / 2 - 1;
localparam B5_divider = base_clock_frequency			/ 987.77 / 2 - 1;
localparam C6_divider = base_clock_frequency			/ 1046.50 / 2 - 1;
localparam Cd6_Db6_divider = base_clock_frequency	/ 1108.73 / 2 - 1;
localparam D6_divider = base_clock_frequency			/ 1174.66 / 2 - 1;
localparam Dd6_Eb6_divider = base_clock_frequency	/ 1244.51 / 2 - 1;
localparam E6_divider = base_clock_frequency			/ 1318.51 / 2 - 1;
localparam F6_divider = base_clock_frequency			/ 1396.91 / 2 - 1;
localparam Fd6_Gb6_divider = base_clock_frequency	/ 1479.98 / 2 - 1;
localparam G6_divider = base_clock_frequency			/ 1567.98 / 2 - 1;
localparam Gd6_Ab6_divider = base_clock_frequency	/ 1661.22 / 2 - 1;
localparam A6_divider = base_clock_frequency			/ 1760.00 / 2 - 1;
localparam Ad6_Bb6_divider = base_clock_frequency	/ 1864.66 / 2 - 1;
localparam B6_divider = base_clock_frequency			/ 1975.53 / 2 - 1;
localparam C7_divider = base_clock_frequency			/ 2093.00 / 2 - 1;
localparam Cd7_Db7_divider = base_clock_frequency	/ 2217.46 / 2 - 1;
localparam D7_divider = base_clock_frequency			/ 2349.32 / 2 - 1;
localparam Dd7_Eb7_divider = base_clock_frequency	/ 2489.02 / 2 - 1;
localparam E7_divider = base_clock_frequency			/ 2637.02 / 2 - 1;
localparam F7_divider = base_clock_frequency			/ 2793.83 / 2 - 1;
localparam Fd7_Gb7_divider = base_clock_frequency	/ 2959.96 / 2 - 1;
localparam G7_divider = base_clock_frequency			/ 3135.96 / 2 - 1;
localparam Gd7_Ab7_divider = base_clock_frequency	/ 3322.44 / 2 - 1;
localparam A7_divider = base_clock_frequency			/ 3520.00 / 2 - 1;
localparam Ad7_Bb7_divider = base_clock_frequency	/ 3729.31 / 2 - 1;
localparam B7_divider = base_clock_frequency			/ 3951.07 / 2 - 1;
localparam C8_divider = base_clock_frequency			/ 4186.01 / 2 - 1;
localparam Cd8_Db8_divider = base_clock_frequency	/ 4434.92 / 2 - 1;
localparam D8_divider = base_clock_frequency			/ 4698.63 / 2 - 1;
localparam Dd8_Eb8_divider = base_clock_frequency	/ 4978.03 / 2 - 1;
localparam E8_divider = base_clock_frequency			/ 5274.04 / 2 - 1;
localparam F8_divider = base_clock_frequency			/ 5587.65 / 2 - 1;
localparam Fd8_Gb8_divider = base_clock_frequency	/ 5919.91 / 2 - 1;
localparam G8_divider = base_clock_frequency			/ 6271.93 / 2 - 1;
localparam Gd8_Ab8_divider = base_clock_frequency	/ 6644.88 / 2 - 1;
localparam A8_divider = base_clock_frequency			/ 7040.00 / 2 - 1;
localparam Ad8_Bb8_divider = base_clock_frequency	/ 7458.62 / 2 - 1;
localparam B8_divider = base_clock_frequency			/ 7902.13 / 2 - 1;



reg [18:0] clkdivider;
always @*
	case(note)
		0:			clkdivider = C0_divider;
		1:			clkdivider = Cd0_Db0_divider;
		2:			clkdivider = D0_divider;		
		3:			clkdivider = Dd0_Eb0_divider;
		4:			clkdivider = E0_divider;		
		5:			clkdivider = F0_divider;		
		6:			clkdivider = Fd0_Gb0_divider;
		7:			clkdivider = G0_divider;		
		8:			clkdivider = Gd0_Ab0_divider;
		9:			clkdivider = A0_divider;		
		10:		clkdivider = Ad0_Bb0_divider;
		11:		clkdivider = B0_divider;		
		12:		clkdivider = C1_divider;		
		13:		clkdivider = Cd1_Db1_divider;
		14:		clkdivider = D1_divider;		
		15:		clkdivider = Dd1_Eb1_divider;
		16:		clkdivider = E1_divider;		
		17:		clkdivider = F1_divider;		
		18:		clkdivider = Fd1_Gb1_divider;
		19:		clkdivider = G1_divider;		
		20:		clkdivider = Gd1_Ab1_divider;
		21:		clkdivider = A1_divider;		
		22:		clkdivider = Ad1_Bb1_divider;
		23:		clkdivider = B1_divider;		
		24:		clkdivider = C2_divider;		
		25:		clkdivider = Cd2_Db2_divider;
		26:		clkdivider = D2_divider;		
		27:		clkdivider = Dd2_Eb2_divider;
		28:		clkdivider = E2_divider;		
		29:		clkdivider = F2_divider;		
		30:		clkdivider = Fd2_Gb2_divider;
		31:		clkdivider = G2_divider;		
		32:		clkdivider = Gd2_Ab2_divider;
		33:		clkdivider = A2_divider;		
		34:		clkdivider = Ad2_Bb2_divider;
		35:		clkdivider = B2_divider;		
		36:		clkdivider = C3_divider;		
		37:		clkdivider = Cd3_Db3_divider;
		38:		clkdivider = D3_divider;		
		39:		clkdivider = Dd3_Eb3_divider;
		40:		clkdivider = E3_divider;		
		41:		clkdivider = F3_divider;		
		42:		clkdivider = Fd3_Gb3_divider;
		43:		clkdivider = G3_divider;		
		44:		clkdivider = Gd3_Ab3_divider;
		45:		clkdivider = A3_divider;		
		46:		clkdivider = Ad3_Bb3_divider;
		47:		clkdivider = B3_divider;		
		48:		clkdivider = C4_divider;		
		49:		clkdivider = Cd4_Db4_divider;
		50:		clkdivider = D4_divider;		
		51:		clkdivider = Dd4_Eb4_divider;
		52:		clkdivider = E4_divider;		
		53:		clkdivider = F4_divider;		
		54:		clkdivider = Fd4_Gb4_divider;
		55:		clkdivider = G4_divider;		
		56:		clkdivider = Gd4_Ab4_divider;
		57:		clkdivider = A4_divider;		
		58:		clkdivider = Ad4_Bb4_divider;
		59:		clkdivider = B4_divider;		
		60:		clkdivider = C5_divider;		
		61:		clkdivider = Cd5_Db5_divider;
		62:		clkdivider = D5_divider;		
		63:		clkdivider = Dd5_Eb5_divider;
		64:		clkdivider = E5_divider;		
		65:		clkdivider = F5_divider;		
		66:		clkdivider = Fd5_Gb5_divider;
		67:		clkdivider = G5_divider;		
		68:		clkdivider = Gd5_Ab5_divider;
		69:		clkdivider = A5_divider;		
		70:		clkdivider = Ad5_Bb5_divider;
		71:		clkdivider = B5_divider;		
		72:		clkdivider = C6_divider;		
		73:		clkdivider = Cd6_Db6_divider;
		74:		clkdivider = D6_divider;		
		75:		clkdivider = Dd6_Eb6_divider;
		76:		clkdivider = E6_divider;		
		77:		clkdivider = F6_divider;		
		78:		clkdivider = Fd6_Gb6_divider;
		79:		clkdivider = G6_divider;		
		80:		clkdivider = Gd6_Ab6_divider;
		81:		clkdivider = A6_divider;		
		82:		clkdivider = Ad6_Bb6_divider;
		83:		clkdivider = B6_divider;		
		84:		clkdivider = C7_divider;		
		85:		clkdivider = Cd7_Db7_divider;
		86:		clkdivider = D7_divider;		
		87:		clkdivider = Dd7_Eb7_divider;
		88:		clkdivider = E7_divider;		
		89:		clkdivider = F7_divider;		
		90:		clkdivider = Fd7_Gb7_divider;
		91:		clkdivider = G7_divider;		
		92:		clkdivider = Gd7_Ab7_divider;
		93:		clkdivider = A7_divider;		
		94:		clkdivider = Ad7_Bb7_divider;
		95:		clkdivider = B7_divider;		
		96:		clkdivider = C8_divider;		
		97:		clkdivider = Cd8_Db8_divider;
		98:		clkdivider = D8_divider;		
		99:		clkdivider = Dd8_Eb8_divider;
		100:		clkdivider = E8_divider;		
		101:		clkdivider = F8_divider;		
		102:		clkdivider = Fd8_Gb8_divider;
		103:		clkdivider = G8_divider;		
		104:		clkdivider = Gd8_Ab8_divider;
		105:		clkdivider = A8_divider;		
		106:		clkdivider = Ad8_Bb8_divider;
		107:		clkdivider = B8_divider;
		default: clkdivider = 19'd0;
	endcase

reg [18:0] counter;
always @(posedge clk)
	if(counter==0 || ! out_enable)
		counter <= clkdivider;
	else
		counter <= counter - 1'b1;
		
always @(posedge clk)
	if(counter==0 && out_enable) speaker <= ~speaker;
	else if(!out_enable) speaker <= 1'b0;

endmodule
module playnote(
	input clk,
	input wire [6:0] note,
	input out_enable,
	output reg speaker
);

















































































































localparam base_clock_frequency = 10000000;
localparam C0_divider = base_clock_frequency			/ 16.35 / 2 - 1;
localparam Cd0_Db0_divider = base_clock_frequency	/ 17.32 / 2 - 1;
localparam D0_divider = base_clock_frequency			/ 18.35 / 2 - 1;
localparam Dd0_Eb0_divider = base_clock_frequency	/ 19.45 / 2 - 1;
localparam E0_divider = base_clock_frequency			/ 20.60 / 2 - 1;
localparam F0_divider = base_clock_frequency			/ 21.83 / 2 - 1;
localparam Fd0_Gb0_divider = base_clock_frequency	/ 23.12 / 2 - 1;
localparam G0_divider = base_clock_frequency			/ 24.50 / 2 - 1;
localparam Gd0_Ab0_divider = base_clock_frequency	/ 25.96 / 2 - 1;
localparam A0_divider = base_clock_frequency			/ 27.50 / 2 - 1;
localparam Ad0_Bb0_divider = base_clock_frequency	/ 29.14 / 2 - 1;
localparam B0_divider = base_clock_frequency			/ 30.87 / 2 - 1;
localparam C1_divider = base_clock_frequency			/ 32.70 / 2 - 1;
localparam Cd1_Db1_divider = base_clock_frequency	/ 34.65 / 2 - 1;
localparam D1_divider = base_clock_frequency			/ 36.71 / 2 - 1;
localparam Dd1_Eb1_divider = base_clock_frequency	/ 38.89 / 2 - 1;
localparam E1_divider = base_clock_frequency			/ 41.20 / 2 - 1;
localparam F1_divider = base_clock_frequency			/ 43.65 / 2 - 1;
localparam Fd1_Gb1_divider = base_clock_frequency	/ 46.25 / 2 - 1;
localparam G1_divider = base_clock_frequency			/ 49.00 / 2 - 1;
localparam Gd1_Ab1_divider = base_clock_frequency	/ 51.91 / 2 - 1;
localparam A1_divider = base_clock_frequency			/ 55.00 / 2 - 1;
localparam Ad1_Bb1_divider = base_clock_frequency	/ 58.27 / 2 - 1;
localparam B1_divider = base_clock_frequency			/ 61.74 / 2 - 1;
localparam C2_divider = base_clock_frequency			/ 65.41 / 2 - 1;
localparam Cd2_Db2_divider = base_clock_frequency	/ 69.30 / 2 - 1;
localparam D2_divider = base_clock_frequency			/ 73.42 / 2 - 1;
localparam Dd2_Eb2_divider = base_clock_frequency	/ 77.78 / 2 - 1;
localparam E2_divider = base_clock_frequency			/ 82.41 / 2 - 1;
localparam F2_divider = base_clock_frequency			/ 87.31 / 2 - 1;
localparam Fd2_Gb2_divider = base_clock_frequency	/ 92.50 / 2 - 1;
localparam G2_divider = base_clock_frequency			/ 98.00 / 2 - 1;
localparam Gd2_Ab2_divider = base_clock_frequency	/ 103.83 / 2 - 1;
localparam A2_divider = base_clock_frequency			/ 110.00 / 2 - 1;
localparam Ad2_Bb2_divider = base_clock_frequency	/ 116.54 / 2 - 1;
localparam B2_divider = base_clock_frequency			/ 123.47 / 2 - 1;
localparam C3_divider = base_clock_frequency			/ 130.81 / 2 - 1;
localparam Cd3_Db3_divider = base_clock_frequency	/ 138.59 / 2 - 1;
localparam D3_divider = base_clock_frequency			/ 146.83 / 2 - 1;
localparam Dd3_Eb3_divider = base_clock_frequency	/ 155.56 / 2 - 1;
localparam E3_divider = base_clock_frequency			/ 164.81 / 2 - 1;
localparam F3_divider = base_clock_frequency			/ 174.61 / 2 - 1;
localparam Fd3_Gb3_divider = base_clock_frequency	/ 185.00 / 2 - 1;
localparam G3_divider = base_clock_frequency			/ 196.00 / 2 - 1;
localparam Gd3_Ab3_divider = base_clock_frequency	/ 207.65 / 2 - 1;
localparam A3_divider = base_clock_frequency			/ 220.00 / 2 - 1;
localparam Ad3_Bb3_divider = base_clock_frequency	/ 233.08 / 2 - 1;
localparam B3_divider = base_clock_frequency			/ 246.94 / 2 - 1;
localparam C4_divider = base_clock_frequency			/ 261.63 / 2 - 1;
localparam Cd4_Db4_divider = base_clock_frequency	/ 277.18 / 2 - 1;
localparam D4_divider = base_clock_frequency			/ 293.66 / 2 - 1;
localparam Dd4_Eb4_divider = base_clock_frequency	/ 311.13 / 2 - 1;
localparam E4_divider = base_clock_frequency			/ 329.63 / 2 - 1;
localparam F4_divider = base_clock_frequency			/ 349.23 / 2 - 1;
localparam Fd4_Gb4_divider = base_clock_frequency	/ 369.99 / 2 - 1;
localparam G4_divider = base_clock_frequency			/ 392.00 / 2 - 1;
localparam Gd4_Ab4_divider = base_clock_frequency	/ 415.30 / 2 - 1;
localparam A4_divider = base_clock_frequency			/ 440.00 / 2 - 1;
localparam Ad4_Bb4_divider = base_clock_frequency	/ 466.16 / 2 - 1;
localparam B4_divider = base_clock_frequency			/ 493.88 / 2 - 1;
localparam C5_divider = base_clock_frequency			/ 523.25 / 2 - 1;
localparam Cd5_Db5_divider = base_clock_frequency	/ 554.37 / 2 - 1;
localparam D5_divider = base_clock_frequency			/ 587.33 / 2 - 1;
localparam Dd5_Eb5_divider = base_clock_frequency	/ 622.25 / 2 - 1;
localparam E5_divider = base_clock_frequency			/ 659.25 / 2 - 1;
localparam F5_divider = base_clock_frequency			/ 698.46 / 2 - 1;
localparam Fd5_Gb5_divider = base_clock_frequency	/ 739.99 / 2 - 1;
localparam G5_divider = base_clock_frequency			/ 783.99 / 2 - 1;
localparam Gd5_Ab5_divider = base_clock_frequency	/ 830.61 / 2 - 1;
localparam A5_divider = base_clock_frequency			/ 880.00 / 2 - 1;
localparam Ad5_Bb5_divider = base_clock_frequency	/ 932.33 / 2 - 1;
localparam B5_divider = base_clock_frequency			/ 987.77 / 2 - 1;
localparam C6_divider = base_clock_frequency			/ 1046.50 / 2 - 1;
localparam Cd6_Db6_divider = base_clock_frequency	/ 1108.73 / 2 - 1;
localparam D6_divider = base_clock_frequency			/ 1174.66 / 2 - 1;
localparam Dd6_Eb6_divider = base_clock_frequency	/ 1244.51 / 2 - 1;
localparam E6_divider = base_clock_frequency			/ 1318.51 / 2 - 1;
localparam F6_divider = base_clock_frequency			/ 1396.91 / 2 - 1;
localparam Fd6_Gb6_divider = base_clock_frequency	/ 1479.98 / 2 - 1;
localparam G6_divider = base_clock_frequency			/ 1567.98 / 2 - 1;
localparam Gd6_Ab6_divider = base_clock_frequency	/ 1661.22 / 2 - 1;
localparam A6_divider = base_clock_frequency			/ 1760.00 / 2 - 1;
localparam Ad6_Bb6_divider = base_clock_frequency	/ 1864.66 / 2 - 1;
localparam B6_divider = base_clock_frequency			/ 1975.53 / 2 - 1;
localparam C7_divider = base_clock_frequency			/ 2093.00 / 2 - 1;
localparam Cd7_Db7_divider = base_clock_frequency	/ 2217.46 / 2 - 1;
localparam D7_divider = base_clock_frequency			/ 2349.32 / 2 - 1;
localparam Dd7_Eb7_divider = base_clock_frequency	/ 2489.02 / 2 - 1;
localparam E7_divider = base_clock_frequency			/ 2637.02 / 2 - 1;
localparam F7_divider = base_clock_frequency			/ 2793.83 / 2 - 1;
localparam Fd7_Gb7_divider = base_clock_frequency	/ 2959.96 / 2 - 1;
localparam G7_divider = base_clock_frequency			/ 3135.96 / 2 - 1;
localparam Gd7_Ab7_divider = base_clock_frequency	/ 3322.44 / 2 - 1;
localparam A7_divider = base_clock_frequency			/ 3520.00 / 2 - 1;
localparam Ad7_Bb7_divider = base_clock_frequency	/ 3729.31 / 2 - 1;
localparam B7_divider = base_clock_frequency			/ 3951.07 / 2 - 1;
localparam C8_divider = base_clock_frequency			/ 4186.01 / 2 - 1;
localparam Cd8_Db8_divider = base_clock_frequency	/ 4434.92 / 2 - 1;
localparam D8_divider = base_clock_frequency			/ 4698.63 / 2 - 1;
localparam Dd8_Eb8_divider = base_clock_frequency	/ 4978.03 / 2 - 1;
localparam E8_divider = base_clock_frequency			/ 5274.04 / 2 - 1;
localparam F8_divider = base_clock_frequency			/ 5587.65 / 2 - 1;
localparam Fd8_Gb8_divider = base_clock_frequency	/ 5919.91 / 2 - 1;
localparam G8_divider = base_clock_frequency			/ 6271.93 / 2 - 1;
localparam Gd8_Ab8_divider = base_clock_frequency	/ 6644.88 / 2 - 1;
localparam A8_divider = base_clock_frequency			/ 7040.00 / 2 - 1;
localparam Ad8_Bb8_divider = base_clock_frequency	/ 7458.62 / 2 - 1;
localparam B8_divider = base_clock_frequency			/ 7902.13 / 2 - 1;



reg [18:0] clkdivider;
always @*
	case(note)
		0:			clkdivider = C0_divider;
		1:			clkdivider = Cd0_Db0_divider;
		2:			clkdivider = D0_divider;		
		3:			clkdivider = Dd0_Eb0_divider;
		4:			clkdivider = E0_divider;		
		5:			clkdivider = F0_divider;		
		6:			clkdivider = Fd0_Gb0_divider;
		7:			clkdivider = G0_divider;		
		8:			clkdivider = Gd0_Ab0_divider;
		9:			clkdivider = A0_divider;		
		10:		clkdivider = Ad0_Bb0_divider;
		11:		clkdivider = B0_divider;		
		12:		clkdivider = C1_divider;		
		13:		clkdivider = Cd1_Db1_divider;
		14:		clkdivider = D1_divider;		
		15:		clkdivider = Dd1_Eb1_divider;
		16:		clkdivider = E1_divider;		
		17:		clkdivider = F1_divider;		
		18:		clkdivider = Fd1_Gb1_divider;
		19:		clkdivider = G1_divider;		
		20:		clkdivider = Gd1_Ab1_divider;
		21:		clkdivider = A1_divider;		
		22:		clkdivider = Ad1_Bb1_divider;
		23:		clkdivider = B1_divider;		
		24:		clkdivider = C2_divider;		
		25:		clkdivider = Cd2_Db2_divider;
		26:		clkdivider = D2_divider;		
		27:		clkdivider = Dd2_Eb2_divider;
		28:		clkdivider = E2_divider;		
		29:		clkdivider = F2_divider;		
		30:		clkdivider = Fd2_Gb2_divider;
		31:		clkdivider = G2_divider;		
		32:		clkdivider = Gd2_Ab2_divider;
		33:		clkdivider = A2_divider;		
		34:		clkdivider = Ad2_Bb2_divider;
		35:		clkdivider = B2_divider;		
		36:		clkdivider = C3_divider;		
		37:		clkdivider = Cd3_Db3_divider;
		38:		clkdivider = D3_divider;		
		39:		clkdivider = Dd3_Eb3_divider;
		40:		clkdivider = E3_divider;		
		41:		clkdivider = F3_divider;		
		42:		clkdivider = Fd3_Gb3_divider;
		43:		clkdivider = G3_divider;		
		44:		clkdivider = Gd3_Ab3_divider;
		45:		clkdivider = A3_divider;		
		46:		clkdivider = Ad3_Bb3_divider;
		47:		clkdivider = B3_divider;		
		48:		clkdivider = C4_divider;		
		49:		clkdivider = Cd4_Db4_divider;
		50:		clkdivider = D4_divider;		
		51:		clkdivider = Dd4_Eb4_divider;
		52:		clkdivider = E4_divider;		
		53:		clkdivider = F4_divider;		
		54:		clkdivider = Fd4_Gb4_divider;
		55:		clkdivider = G4_divider;		
		56:		clkdivider = Gd4_Ab4_divider;
		57:		clkdivider = A4_divider;		
		58:		clkdivider = Ad4_Bb4_divider;
		59:		clkdivider = B4_divider;		
		60:		clkdivider = C5_divider;		
		61:		clkdivider = Cd5_Db5_divider;
		62:		clkdivider = D5_divider;		
		63:		clkdivider = Dd5_Eb5_divider;
		64:		clkdivider = E5_divider;		
		65:		clkdivider = F5_divider;		
		66:		clkdivider = Fd5_Gb5_divider;
		67:		clkdivider = G5_divider;		
		68:		clkdivider = Gd5_Ab5_divider;
		69:		clkdivider = A5_divider;		
		70:		clkdivider = Ad5_Bb5_divider;
		71:		clkdivider = B5_divider;		
		72:		clkdivider = C6_divider;		
		73:		clkdivider = Cd6_Db6_divider;
		74:		clkdivider = D6_divider;		
		75:		clkdivider = Dd6_Eb6_divider;
		76:		clkdivider = E6_divider;		
		77:		clkdivider = F6_divider;		
		78:		clkdivider = Fd6_Gb6_divider;
		79:		clkdivider = G6_divider;		
		80:		clkdivider = Gd6_Ab6_divider;
		81:		clkdivider = A6_divider;		
		82:		clkdivider = Ad6_Bb6_divider;
		83:		clkdivider = B6_divider;		
		84:		clkdivider = C7_divider;		
		85:		clkdivider = Cd7_Db7_divider;
		86:		clkdivider = D7_divider;		
		87:		clkdivider = Dd7_Eb7_divider;
		88:		clkdivider = E7_divider;		
		89:		clkdivider = F7_divider;		
		90:		clkdivider = Fd7_Gb7_divider;
		91:		clkdivider = G7_divider;		
		92:		clkdivider = Gd7_Ab7_divider;
		93:		clkdivider = A7_divider;		
		94:		clkdivider = Ad7_Bb7_divider;
		95:		clkdivider = B7_divider;		
		96:		clkdivider = C8_divider;		
		97:		clkdivider = Cd8_Db8_divider;
		98:		clkdivider = D8_divider;		
		99:		clkdivider = Dd8_Eb8_divider;
		100:		clkdivider = E8_divider;		
		101:		clkdivider = F8_divider;		
		102:		clkdivider = Fd8_Gb8_divider;
		103:		clkdivider = G8_divider;		
		104:		clkdivider = Gd8_Ab8_divider;
		105:		clkdivider = A8_divider;		
		106:		clkdivider = Ad8_Bb8_divider;
		107:		clkdivider = B8_divider;
		default: clkdivider = 19'd0;
	endcase

reg [18:0] counter;
always @(posedge clk)
	if(counter==0 || ! out_enable)
		counter <= clkdivider;
	else
		counter <= counter - 1'b1;
		
always @(posedge clk)
	if(counter==0 && out_enable) speaker <= ~speaker;
	else if(!out_enable) speaker <= 1'b0;

endmodule