Skip to content

Commit

Permalink
getting stuck, commiting for the night
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Berg committed Nov 30, 2015
1 parent 57c7a5e commit a219a0c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Nexys4Game/src/hdl/CL_block.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module CL_block(
output SD_SCK,
output SD_CMD,
output [37*16-1:0] metadata_link,
output [36:0] metadata_available,
output reset, //status signal for reset
output pause, //status signal for game-pause
output song_time //current song_time
Expand Down Expand Up @@ -153,9 +154,12 @@ module CL_block(
.clk25(clk25),
.write_en(write_data),
.write_word(data_word),
.metadata_request(metadata_request),

//TODO

.metadata_available(),
.metadata_link(metadata_link),
.loaded(data_loaded)
);

Expand Down
8 changes: 8 additions & 0 deletions Nexys4Game/src/hdl/CL_metadata_controller.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module CL_metadata_controller(
input clk25, //25mhz clk
input write_en, //signals a new word to be written
input [31:0] write_word, //word to be written
input [36:0] metadata_request,

output reg [36:0] metadata_available,
output reg [37*16-1:0] metadata_link,
output reg loaded

);
Expand All @@ -12,6 +15,7 @@ module CL_metadata_controller(
reg [11:0] new_pointer = 0; //1 clk delay on updating pointer

initial loaded = 0;
initial metadata_link = 0;

reg we;
reg [31:0] din;
Expand All @@ -35,6 +39,10 @@ module CL_metadata_controller(
we <= 0;
end
pointer <= new_pointer;

if(metadata_request != 0) begin
end

end


Expand Down
2 changes: 2 additions & 0 deletions Nexys4Game/src/hdl/SC_block.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module SC_block(
input [15:0] song_time, //current song time
input [36:0] NDATA, //deserialized note data
input [37*16-1:0] metadata_link, //input from the metadata table
input [36:0] metadata_available,

output [36:0] metadata_request, //request line to metadata table
output [31:0] score, //score output to the AV block ARBITRARY WIDTH
Expand All @@ -25,6 +26,7 @@ module SC_block(
.NDATA(NDATA),
.metadata_link(metadata_link),
.metadata_request(metadata_request),
.metadata_available(metadata_available),
.match_trigger(match_trigger),
.match_time(match_time)
);
Expand Down
8 changes: 5 additions & 3 deletions Nexys4Game/src/hdl/SC_note_matching_sub.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module SC_note_matching_sub(
input [15:0] song_time, //current song time
input note_edge, //if note has become active (must be a single-cycle pulse)
input [15:0] note_time, //time of next note, or all 1's if no note in buffer
input note_available, //high when note requested is available
output reg note_request, //a pulse if a new note is needed to be shifted in
output reg match_enable, //a pulse signaling a new note-match
output reg [15:0] match_time //time which the note has been matched to.
Expand All @@ -20,15 +21,16 @@ module SC_note_matching_sub(

if(future_note < song_time && ~note_request) begin //if future note not in the future
past_note <= future_note; //shift in the new past_note
future_note <= 0; //invalid, will fail to match with extremely high probability due to overflow
note_request <= 1; //request new note
end
else note_request <= 0;

if(note_request) begin
if(note_request && note_available) begin
note_request <= 0; //stop requesting
future_note <= note_time; //shift in new future note
end

if(song_time - past_note > NOTE_TIMEOUT) begin //if nearest note is timed-out MAY CONTAIN SIGN PROBLEMS
if(song_time > NOTE_TIMEOUT + past_note) begin //if nearest note is timed-out
past_note <= 0; //write invalid
end

Expand Down
3 changes: 2 additions & 1 deletion Nexys4Game/src/hdl/SC_note_matching_super.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module SC_note_matching_super(
input [15:0] song_time,
input [36:0] NDATA,
input [37*16-1:0] metadata_link,
input [36:0] metadata_available,

output [36:0] metadata_request,
output [36:0] match_trigger,
Expand All @@ -14,7 +15,7 @@ module SC_note_matching_super(

//create 37 note_matcher_submodules
SC_note_matching_sub note_matcher [36:0] (.clk(clk), .song_time(song_time),
.note_edge(note_edge), .note_time(metadata_link),
.note_edge(note_edge), .note_time(metadata_link), .note_available(metadata_available),
.note_request(metadata_request), .match_enable(match_trigger),
.match_time(match_time));

Expand Down
4 changes: 3 additions & 1 deletion Nexys4Game/src/hdl/nexys4_game.v
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ module nexys4_game(
wire pause, reset;

wire [37*16-1:0] metadata_link;
wire [36:0] metadata_request;
wire [36:0] metadata_request, metadata_available;

SC_block SC(
.clk(CLK100MHZ),
.pause(pause),
.song_time(song_time),
.NDATA(),
.metadata_link(metadata_link),
.metadata_available(metadata_available),

.metadata_request(metadata_request),
.score(),
Expand All @@ -100,6 +101,7 @@ module nexys4_game(
.SD_SCK(),
.SD_CMD(),
.metadata_link(metadata_link),
.metadata_available(metadata_available),
.reset(reset),
.pause(pause),
.song_time(song_time)
Expand Down

0 comments on commit a219a0c

Please sign in to comment.