Skip to content

Commit 68bf28c

Browse files
committed
Fixing active and unactive zones of the VGA vsync and hsync
1 parent 3b43fe7 commit 68bf28c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

modules/vga/include/vga.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* the next display period
2525
*/
2626
template <
27+
unsigned int N = 8,
2728
unsigned int H_ACTIVE = 640,
2829
unsigned int H_FP = 16,
2930
unsigned int H_SYNC_PULSE = 96,
@@ -89,21 +90,19 @@ SC_MODULE(vga)
8990
{
9091
this->o_hsync.write(IPS_VGA_ACTIVE);
9192
}
92-
// End of H-sync pulse
9393
else if (this->h_count == (H_SYNC_PULSE + H_BP))
9494
{
9595
this->o_hsync.write(IPS_VGA_ACTIVE);
9696
}
97-
// H front porch
9897
else if (this->h_count == (H_SYNC_PULSE + H_BP + H_ACTIVE))
9998
{
100-
this->o_hsync.write(IPS_VGA_INACTIVE);
99+
this->o_hsync.write(IPS_VGA_ACTIVE);
101100
}
102101
// End of HSYNC
103102
else if (this->h_count == (H_SYNC_PULSE + H_BP + H_ACTIVE + H_FP))
104103
{
105104
// Restart H counter
106-
this->o_hsync.write(IPS_VGA_ACTIVE);
105+
this->o_hsync.write(IPS_VGA_INACTIVE);
107106
this->h_count = 0;
108107

109108
// Increment H counter
@@ -112,7 +111,7 @@ SC_MODULE(vga)
112111
// VSYNC pulse
113112
if (this->v_count == V_SYNC_PULSE)
114113
{
115-
this->o_vsync.write(IPS_VGA_INACTIVE);
114+
this->o_vsync.write(IPS_VGA_ACTIVE);
116115
}
117116
// End of V-sync pulse
118117
else if (this->v_count == (V_SYNC_PULSE + V_BP))
@@ -122,12 +121,12 @@ SC_MODULE(vga)
122121
// V front porch
123122
else if (this->v_count == (V_SYNC_PULSE + V_BP + V_ACTIVE))
124123
{
125-
this->o_vsync.write(IPS_VGA_INACTIVE);
124+
this->o_vsync.write(IPS_VGA_ACTIVE);
126125
}
127126
// End of VSYNC
128127
else if (this->v_count == (V_SYNC_PULSE + V_BP + V_ACTIVE + V_FP))
129128
{
130-
this->o_vsync.write(IPS_VGA_ACTIVE);
129+
this->o_vsync.write(IPS_VGA_INACTIVE);
131130
this->v_count = 0;
132131
}
133132
}

modules/vga/src/vga_tb.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#define TOTAL_VERTICAL (H_ACTIVE + H_FP + H_SYNC_PULSE + H_BP)
3131
#define TOTAL_HORIZONTAL (V_ACTIVE + V_FP + V_SYNC_PULSE + V_BP)
3232
#define TOTAL_PIXELES (TOTAL_VERTICAL * TOTAL_HORIZONTAL)
33+
// Number of bits for ADC, DAC and VGA
34+
#define BITS 8
3335

3436

3537
int sc_main(int, char*[])
@@ -97,6 +99,7 @@ int sc_main(int, char*[])
9799

98100
// VGA module instanciation and connections
99101
vga<
102+
BITS,
100103
H_ACTIVE, H_FP, H_SYNC_PULSE, H_BP,
101104
V_ACTIVE, V_FP, V_SYNC_PULSE, V_BP
102105
> ips_vga("ips_vga");

0 commit comments

Comments
 (0)