Skip to content

Commit

Permalink
target-panog1: adjust vga timing; add cartridge ram
Browse files Browse the repository at this point in the history
  • Loading branch information
zephray committed Apr 14, 2019
1 parent ecfc75f commit 68e413f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
33 changes: 28 additions & 5 deletions target/panog1/fpga/pano_top.v
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ module pano_top(
// ----------------------------------------------------------------------
// MBC5
wire [22:0] vb_rom_a;
wire [16:0] vb_ram_a;
wire vb_ram_cs_n;
wire [7:0] vb_crom_dout;
mbc5 mbc5(
.vb_clk(clk_4),
.vb_a(vb_a[15:12]),
Expand All @@ -274,11 +277,31 @@ module pano_top(
.vb_rd(vb_rd),
.vb_rst(vb_rst),
.rom_a(vb_rom_a[22:14]),
.ram_a(),
.ram_a(vb_ram_a[16:13]),
.rom_cs_n(),
.ram_cs_n()
.ram_cs_n(vb_ram_cs_n)
);
assign vb_rom_a[13:0] = vb_a[13:0];
assign vb_ram_a[12:0] = vb_a[12:0];

// ----------------------------------------------------------------------
// Cartridge RAM
// Work RAM
wire [7:0] vb_cram_dout;
wire vb_cram_wr = !vb_ram_cs_n & vb_wr;

singleport_ram #(
.WORDS(32768),
.ABITS(15)
) br_cram (
.clka(clk_4),
.wea(vb_cram_wr),
.addra(vb_ram_a[14:0]),
.dina(vb_dout),
.douta(vb_cram_dout)
);

assign vb_din = (vb_ram_cs_n) ? (vb_crom_dout) : (vb_cram_dout);

// ----------------------------------------------------------------------
// Audio
Expand Down Expand Up @@ -448,9 +471,9 @@ module pano_top(
.ddr_valid(ddr_valid),
.ddr_ready(ddr_ready),
.vb_a(vb_rom_a),
.vb_din(vb_din),
.vb_dout(vb_dout),
.vb_rd(vb_rd),
.vb_din(vb_crom_dout),
.vb_dout(8'h00),
.vb_rd(vb_phi),
.vb_wr(1'b0)
);

Expand Down
7 changes: 4 additions & 3 deletions target/panog1/fpga/vga_timing.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module vga_timing(
);

//Horizontal
parameter H_FRONT = 26; //Front porch
// Sync is adjusted to compensate lower clock frequency
parameter H_FRONT = 18; //Front porch
parameter H_SYNC = 96; //Sync
parameter H_BACK = 38; //Back porch
/*parameter H_FRONT = 16; //Front porch
Expand Down Expand Up @@ -139,11 +140,11 @@ module vga_timing(

assign x = (h_count >= H_BLANK) ? (h_count - H_BLANK) : 11'h0;
assign y = (v_count >= V_BLANK) ? (v_count - V_BLANK) : 11'h0;
wire gb_x_valid = (x > 11'd80)&&(x <= 11'd560);
wire gb_x_valid = (x > 11'd78)&&(x <= 11'd558);
wire gb_y_valid = (y >= 11'd24)&&(y < 11'd456);
assign gb_en = (gb_x_valid)&&(gb_y_valid);
assign gb_grid = (gb_x_grid)||(gb_y_grid);
assign gb_x = (gb_en) ? (gb_x_count - 8'd80) : (8'h0);
assign gb_x = (gb_en) ? (gb_x_count - 8'd77) : (8'h0);
//assign gb_y = (gb_en) ? (gb_y_count - 8'd24) : (8'h0);
assign gb_y = (gb_y_valid) ? (gb_y_count - 8'd23) : (8'h0); // Y should be always available during the period
//assign address = y * H_ACT + x;
Expand Down

0 comments on commit 68e413f

Please sign in to comment.