Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sprite collisions; bus timings; sprite budget #35

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fpga/source/graphics/sprite_renderer.v
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ module sprite_renderer(
// Determine collision for the current pixel
wire [3:0] collision =
linebuf_idx_r < 'd640 &&
(!pixel_is_transparent && sprite_collision_mask_r != 4'b0) ? (linebuf_rddata[15:12] & ~sprite_collision_mask_r) : 4'b0;
(!pixel_is_transparent && sprite_collision_mask_r != 4'b0) ? (linebuf_rddata[15:12] & sprite_collision_mask_r) : 4'b0;

// Render state machine
always @* begin
Expand Down
24 changes: 7 additions & 17 deletions fpga/source/top.v
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,14 @@ module top(
reg [4:0] rdaddr_r;
reg [4:0] wraddr_r;
reg [7:0] wrdata_r;
reg [4:0] wraddrp_r;
reg [7:0] wrdatap_r;
reg [4:0] wraddrn_r;
reg [7:0] wrdatan_r;

always @(posedge clk) begin
wraddrp_r <= extbus_a;
wrdatap_r <= extbus_d;
end
always @(negedge clk) begin
wraddrn_r <= extbus_a;
wrdatan_r <= extbus_d;
end
always @(negedge bus_write) begin
wraddr_r <= clk ? wraddrn_r : wraddrp_r;
wrdata_r <= clk ? wrdatan_r : wrdatap_r;
wrdata_r <= extbus_d;
end
always @(posedge bus_write) begin
wraddr_r <= extbus_a;
end
always @(negedge bus_read) begin
always @(posedge bus_read) begin
rdaddr_r <= extbus_a;
end

Expand Down Expand Up @@ -757,13 +747,13 @@ module top(
// Interface 1 - 32-bit read only
.if1_addr(l0_addr),
.if1_rddata(l0_rddata),
.if1_strobe(l0_strobe),
.if1_strobe(l0_strobe & l0_enabled_r),
.if1_ack(l0_ack),

// Interface 2 - 32-bit read only
.if2_addr(l1_addr),
.if2_rddata(l1_rddata),
.if2_strobe(l1_strobe),
.if2_strobe(l1_strobe & l1_enabled_r),
.if2_ack(l1_ack),

// Interface 3 - 32-bit read only
Expand Down
14 changes: 12 additions & 2 deletions fpga/source/vera_module.sdc
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# 25MHz system clock
create_clock -name {clk25} -period 40 [get_ports clk25]

#create_clock -name {wrclk} -period 125 [get_pins -hierarchical wraddr_r/clock]
#create_clock -name {rdclk} -period 125 [get_pins rdaddr_r/clock]
#create_clock -name {buscs} -period 125 [get_ports extbus_cs_n]
create_clock -name {buswr} -period 125 [get_ports extbus_wr_n]
create_clock -name {busrd} -period 125 [get_ports extbus_rd_n]
#set_input_delay -clock [get_clocks buswr] -10 -clock_fall [get_ports {extbus_d[0] extbus_d[1] extbus_d[2] extbus_d[3] extbus_d[4] extbus_d[5] extbus_d[6] extbus_d[7]}]
#set_clock_latency 10 -source -late [get_clocks buswr]
set_clock_latency 10 -source -early [get_clocks buswr]
set_clock_latency 10 -source -early [get_clocks busrd]

# Define clock domains to be independent
set_clock_groups -group [get_clocks clk25] -asynchronous
set_clock_groups -group [get_clocks clk25] -group [get_clocks {buscs buswr busrd}] -asynchronous

set_output_delay 10 -clock [get_clocks clk25] [get_ports {vga_r[0] vga_r[1] vga_r[2] vga_r[3] vga_g[0] vga_g[1] vga_g[2] vga_g[3] vga_b[0] vga_b[1] vga_b[2] vga_b[3] vga_hsync vga_vsync}]
set_output_delay -clock [get_clocks clk25] 10 [get_ports {vga_r[0] vga_r[1] vga_r[2] vga_r[3] vga_g[0] vga_g[1] vga_g[2] vga_g[3] vga_b[0] vga_b[1] vga_b[2] vga_b[3] vga_hsync vga_vsync}]