Skip to content

Commit

Permalink
midday progress update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Berg committed Dec 7, 2015
1 parent 072f66c commit 763d566
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 73 deletions.
95 changes: 57 additions & 38 deletions Nexys4Game/src/hdl/AV_block.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ module AV_block(

wire [12:0] menu_pixel;
wire blank;
wire [11:0] bg_pixel;
wire [12:0] string_pixel6, string_pixel5, string_pixel4, string_pixel3, string_pixel2, string_pixel1;

xvga xvga(
.vclock(clk65),
.hcount(hcount),
Expand All @@ -34,17 +37,27 @@ module AV_block(
AV_integrator integrator(
.clk65(clk65),
.menu_pixel(menu_pixel),
.score_pixel(),
.string1_pixel(string_pixel1),
.string2_pixel(string_pixel2),
.string3_pixel(string_pixel3),
.string4_pixel(string_pixel4),
.string5_pixel(string_pixel5),
.score_pixel(13'b0),
.string1_pixel(13'b0),
.string2_pixel(13'b0),
.string3_pixel(13'b0),
.string4_pixel(13'b0),
.string5_pixel(13'b0),
.string6_pixel(string_pixel6),
.bg_pixel(),
.pixel( {VGA_R, VGA_G, VGA_B} )
.bg_pixel(bg_pixel),
.pixel( {4'b0, VGA_G, VGA_B} )
);

assign VGA_R = 4'b1111;

AV_bg bg(
.clk65(clk65),
.hcount(hcount),
.vcount(vcount),
.bg_pixel(bg_pixel)
);


AV_menu_graphics menu(
.clk65(clk65),
.pause(pause),
Expand All @@ -53,89 +66,95 @@ module AV_block(
.menu_pixel(menu_pixel)
);

wire string_pixel6;
AV_string string6
AV_string
#(
y_location = 400
)
.y_location(400)
) string6
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[5]),
.fret(fret[29:25]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel6)
)
);

wire string_pixel5;
AV_string string5
AV_string
#(
y_location = 450
)
.y_location(450)
) string5
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[4]),
.fret(fret[24:20]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel5)
)
);

wire string_pixel4;
AV_string string4
AV_string
#(
y_location = 500
)
.y_location(500)
) string4
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[3]),
.fret(fret[19:15]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel4)
)
);

wire string_pixel3;
AV_string string3
AV_string
#(
y_location = 550
)
.y_location(550)
) string3
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[2]),
.fret(fret[14:10]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel3)
)
);

wire string_pixel2;
AV_string string2
AV_string
#(
y_location = 600
)
.y_location(600)
) string2
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[1]),
.fret(fret[9:5]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel2)
)
);

wire string_pixel1;
AV_string string1
AV_string
#(
y_location = 650
)
.y_location(650)
) string1
(
.clk(clk65),
.song_time(song_time),
.match_en(fret_en[0]),
.fret(fret[4:0]),
.match_time(fret_time),
.hcount(hcount),
.vcount(vcount),
.string_pixel(string_pixel1)
)
);


endmodule
2 changes: 1 addition & 1 deletion Nexys4Game/src/hdl/AV_menu_graphics.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module AV_menu_graphics(
if( hcount >= startX && hcount < (startX + WIDTH) &&
vcount >= startY && vcount < (startY + HEIGHT))
menu_pixel <= {pause, COLOR};
else menu_pixel <= 0;
else menu_pixel <= 13'b0;

end

Expand Down
17 changes: 10 additions & 7 deletions Nexys4Game/src/hdl/CL_block.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ module CL_block(
output [36:0] metadata_available,
output reset, //status signal for reset
output pause, //status signal for game-pause
output song_time //current song_time
output [15:0] song_time //current song_time
);

wire data_loaded;
//wire song_loaded;
reg song_loaded = 1; //assuming no song for now

/*
//////////////////////////////////////////////////////////////////////////////////
// SD stuff
Expand Down Expand Up @@ -97,7 +98,7 @@ module CL_block(
.address(adr), // Memory address for read/write operation. This MUST
// be a multiple of 512 bytes, due to SD sectoring.
.clk(clk25), // 25 MHz clock.
.status(state), // For debug purposes: Current state of controller.
.status(state) // For debug purposes: Current state of controller.
);
reg [31:0] data_word;
Expand All @@ -106,7 +107,7 @@ module CL_block(
always @(posedge clk25) begin
/* SD card metadata loading
//SD card metadata loading
if(!data_loaded) begin //need to load metadata
if(ready) begin //begin a read
rd <= 1;
Expand Down Expand Up @@ -146,24 +147,26 @@ module CL_block(
end
adr <= next_adr;
*/
end
//
//////////////////////////////////////////////////////////////////////////////////

*/

wire [36:0] md_request;
assign md_request = metadata_request&(~pause);
CL_metadata_controller metadata_memory(
.clk(clk),
.clk25(clk25),
.write_en(write_data),
.write_word(data_word),
.metadata_request(metadata_request),
.metadata_request(md_request),

//TODO

.metadata_available(),
.metadata_available(metadata_available),
.metadata_link(metadata_link),
.loaded(data_loaded)
);
Expand Down
109 changes: 105 additions & 4 deletions Nexys4Game/src/hdl/CL_metadata_controller.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,114 @@ module CL_metadata_controller(
output reg loaded

);

/*
reg [11:0] pointer = 0;
reg [11:0] new_pointer = 0; //1 clk delay on updating pointer
*/



initial loaded = 0;
initial loaded = 1;
initial metadata_link = 0;

reg [255:0] note24;
reg [255:0] note26;
reg [255:0] note28;
reg [255:0] note31;

initial begin
note24[255:240] = 400;
note24[239:224] = 2000;
note24[223:208] = 3000;
note24[207:192] = 0;
note24[191:176] = 0;
note24[175:160] = 0;
note24[159:144] = 0;
note24[143:128] = 0;
note24[127:112] = 0;
note24[111:96] = 0;
note24[95:80] = 0;
note24[79:64] = 0;
note24[63:48] = 0;
note24[47:32] = 0;
note24[31:16] = 0;
note24[15:0] = 0;

note26[255:240] = 300;
note26[239:224] = 500;
note26[223:208] = 1000;
note26[207:192] = 1100;
note26[191:176] = 1200;
note26[175:160] = 1900;
note26[159:144] = 2100;
note26[143:128] = 2600;
note26[127:112] = 2700;
note26[111:96] = 2900;
note26[95:0] = 0;

note28[255:240] = 200;
note28[239:224] = 600;
note28[223:208] = 700;
note28[207:192] = 800;
note28[191:176] = 1400;
note28[175:160] = 1800;
note28[159:144] = 2200;
note28[143:128] = 2300;
note28[127:112] = 2400;
note28[111:96] = 2500;
note28[95:80] = 2800;
note28[79:0] = 0;

note31[255:240] = 1500;
note31[239:224] = 1600;
note31[223:0] = 0;
end

always @(posedge clk) begin
if(metadata_request[24] == 1) begin
metadata_link[24*16-1:23*16] <= note24[255:240];
note24[255:0] <= {note24[240:0],16'b0};
metadata_available[24] <= 1;
//if(note24[255:240] != 0) begin
// metadata_available[24] <= 1;
//end
//else
// metadata_available[24] <= 0;
end
else metadata_available[24] <= 0;

if(metadata_request[26] == 1) begin
metadata_link[26*16-1:25*16] <= note26[255:240];
note26[255:0] <= {note26[240:0],16'b0};
if(note26[255:240] != 0) begin
metadata_available[26] <= 1;
end
else
metadata_available[26] <= 0;
end

if(metadata_request[28] == 1) begin
metadata_link[28*16-1:27*16] <= note28[255:240];
note28[255:0] <= {note28[240:0],16'b0};
if(note28[255:240] != 0) begin
metadata_available[28] <= 1;
end
else
metadata_available[28] <= 0;
end

if(metadata_request[31] == 1) begin
metadata_link[31*16-1:30*16] <= note31[255:240];
note31[255:0] <= {note31[240:0],16'b0};
if(note31[255:240] != 0) begin
metadata_available[31] <= 1;
end
else
metadata_available[31] <= 0;
end
end

/*
reg we;
reg [31:0] din;
wire [31:0] dout;
Expand Down Expand Up @@ -44,6 +145,6 @@ module CL_metadata_controller(
end
end

*/

endmodule
2 changes: 1 addition & 1 deletion Nexys4Game/src/hdl/CL_song_timer.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module CL_song_timer(
input clk, //100mhz clock
input pause, //high if game is paused
input reset, //high to clear song_time
output reg song_time //10ms clock with pause
output reg [15:0] song_time //10ms clock with pause
);

reg [19:0] counter; //counts to 1_000_000
Expand Down
Loading

0 comments on commit 763d566

Please sign in to comment.