Skip to content

Commit

Permalink
Signals generation, timing to be verified and EBR implementation for …
Browse files Browse the repository at this point in the history
…MAchXO2 must be done
  • Loading branch information
leonow32 committed Jun 1, 2024
1 parent a5d496f commit f5bf90f
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 221 deletions.
Binary file modified vga/05_text_terminal/font.xlsx
Binary file not shown.
30 changes: 15 additions & 15 deletions vga/05_text_terminal/font_0_127.mem
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@

// Char 1
FF // ........
00 // ........
7E // .######.
81 // #......#
A5 // #.#..#.#
81 // #......#
81 // #......#
BD // #.####.#
99 // #..##..#
81 // #......#
81 // #......#
7E // .######.
00 // ........
00 // ........
00 // ........
00 // ........
FF // ........
FF // .######.
FF // #......#
FF // #.#..#.#
FF // #......#
FF // #......#
FF // #.####.#
FF // #..##..#
FF // #......#
FF // #......#
FF // .######.
FF // ........
FF // ........
FF // ........
FF // ........

// Char 2
00 // ........
Expand Down
File renamed without changes.
86 changes: 86 additions & 0 deletions vga/05_text_terminal/old.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Character memory
wire [11:0] CharWriteAddress = CursorY * 80 + CursorX; // Range 0..2399
wire [11:0] CharReadAddress;

// Multiplexer for memory outputs
wire [7:0] CharDataFromRAM_0;
wire [7:0] CharDataFromRAM_1;
wire [7:0] CharDataFromRAM_2;
wire [7:0] CharDataFromRAM = (CharReadAddress[11:10] == 2'd0) ? CharDataFromRAM_0 :
(CharReadAddress[11:10] == 2'd1) ? CharDataFromRAM_1 :
(CharReadAddress[11:10] == 2'd2) ? CharDataFromRAM_2 :
8'd0;

// Memory blocks
PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024)
) CharRAM_0(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd0), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd0)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_0)
);

PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024)
) CharRAM_1(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd1), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd1)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_1)
);

PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(352)
) CharRAM_2(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd2), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd2)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_2)
);
*/

// Font Memory
/*
wire [10:0] FontAddress;
wire [7:0] FontDataFromROM_0;
wire [7:0] FontDataFromROM_1;
wire [7:0] FontDataFromROM = (FontAddress[10] == 1'd0) ? FontDataFromROM_0 : FontDataFromROM_1;
// Characters 32...95
ROM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024),
.MEMORY_FILE("font_32_95.mem")
) FontROM_0(
.Clock(Clock),
.Reset(Reset),
.ReadEnable_i(1'b1),
.Address_i(FontAddress[9:0]),
.Data_o(FontDataFromROM_0)
);
122 changes: 24 additions & 98 deletions vga/05_text_terminal/top.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ module top #(
);

// Currently displayed Character
input [6:0] Column; // Range 0..79
input [4:0] Row; // Range 0..29
input [3:0] Line; // Range 0..15
wire [6:0] Column; // Range 0..79
wire [4:0] Row; // Range 0..29
wire [3:0] Line; // Range 0..15

// Signals between memory and VGA modules
wire MemoryReadRequest;
wire DataReady;
wire [7:0] Pixels;
wire [2:0] ColorForeground;
wire [2:0] ColorBackground;

// UART data receiver
wire DataReceivedEvent;
Expand All @@ -43,117 +48,36 @@ module top #(
Memory Memory_inst(
.Clock(Clock),
.Reset(Reset),

.AnalyzeRequest_i(DataReceivedEvent),
.DataFromUART_i(DataFromUART),

.ReadRequest_i(MemoryReadRequest),
.Column_i(Column),
.Row_i(Row),
.Line_i(Line),
.DataReady_o(),
.Pixels_o(),
.ColorForeground_o(),
.ColorBackground_o()

.DataReady_o(DataReady),
.Pixels_o(Pixels),
.ColorForeground_o(ColorForeground),
.ColorBackground_o(ColorBackground)
);

// Character memory
/*
wire [11:0] CharWriteAddress = CursorY * 80 + CursorX; // Range 0..2399
wire [11:0] CharReadAddress;
// Multiplexer for memory outputs
wire [7:0] CharDataFromRAM_0;
wire [7:0] CharDataFromRAM_1;
wire [7:0] CharDataFromRAM_2;
wire [7:0] CharDataFromRAM = (CharReadAddress[11:10] == 2'd0) ? CharDataFromRAM_0 :
(CharReadAddress[11:10] == 2'd1) ? CharDataFromRAM_1 :
(CharReadAddress[11:10] == 2'd2) ? CharDataFromRAM_2 :
8'd0;
// Memory blocks
PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024)
) CharRAM_0(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd0), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd0)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_0)
);
PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024)
) CharRAM_1(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd1), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd1)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_1)
);
PseudoDualPortRAM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(352)
) CharRAM_2(
.ReadClock(Clock),
.WriteClock(Clock),
.Reset(Reset),
.ReadEnable_i(CharReadAddress[11:10] == 2'd2), // Czy to potrzebne
.WriteEnable_i(CharWriteRequest && (CharWriteAddress[11:10] == 2'd2)),
.ReadAddress_i(CharReadAddress[9:0]),
.WriteAddress_i(CharWriteAddress[9:0]),
.Data_i(DataFromUART),
.Data_o(CharDataFromRAM_2)
);
*/

// Font Memory
/*
wire [10:0] FontAddress;
wire [7:0] FontDataFromROM_0;
wire [7:0] FontDataFromROM_1;
wire [7:0] FontDataFromROM = (FontAddress[10] == 1'd0) ? FontDataFromROM_0 : FontDataFromROM_1;
// Characters 32...95
ROM #(
.ADDRESS_WIDTH(10),
.DATA_WIDTH(8),
.MEMORY_DEPTH(1024),
.MEMORY_FILE("font_32_95.mem")
) FontROM_0(
.Clock(Clock),
.Reset(Reset),
.ReadEnable_i(1'b1),
.Address_i(FontAddress[9:0]),
.Data_o(FontDataFromROM_0)
);
*/

// VGA instance
VGA VGA_inst(
.Clock(Clock),
.Reset(Reset),

.MemoryReadRequest_o(MemoryReadRequest),
.Column_o(Column),
.Row_o(Row),
.Line_o(Line),
.PixelsToDisplay_i(8'd0),
.ColorForeground_i(3'b111),
.ColorBackground_i(3'b000),

.DataReady_i(DataReady),
.PixelsToDisplay_i(Pixels),
.ColorForeground_i(ColorForeground),
.ColorBackground_i(ColorBackground),

.Red_o(Red_o),
.Green_o(Green_o),
.Blue_o(Blue_o),
Expand All @@ -162,3 +86,5 @@ module top #(
);

endmodule

`default_nettype wire
Loading

0 comments on commit f5bf90f

Please sign in to comment.