All test cases run through!

This commit is contained in:
jaseg 2021-06-17 14:23:17 +02:00
parent 8376dde077
commit 0de373c3af
4 changed files with 144 additions and 64 deletions

View file

@ -42,7 +42,7 @@
<Option Name="IPUserFilesDir" Val="$PIPUSERFILESDIR"/>
<Option Name="IPStaticSourceDir" Val="$PIPUSERFILESDIR/ipstatic"/>
<Option Name="EnableBDX" Val="FALSE"/>
<Option Name="WTXSimLaunchSim" Val="189"/>
<Option Name="WTXSimLaunchSim" Val="220"/>
<Option Name="WTModelSimLaunchSim" Val="0"/>
<Option Name="WTQuestaLaunchSim" Val="0"/>
<Option Name="WTIesLaunchSim" Val="0"/>

View file

@ -34,7 +34,7 @@ module window_matcher(
output [7:0] out_red, [7:0] out_green, [7:0] out_blue,
/* Overlay data IO */
output win_hsync, win_vsync,
output reg win_hsync, reg win_vsync,
output win_blank,
output reg [11:0] win_w,
output reg [11:0] win_h,
@ -92,8 +92,8 @@ module window_matcher(
/* Window matching state machine */
reg [11:0] scan_x;
reg [11:0] scan_y;
reg [11:0] window_x;
reg [11:0] window_y;
reg [11:0] win_x_int;
reg [11:0] win_y_int;
reg [11:0] win_w_int;
reg [11:0] win_h_int;
reg win_hsync_int, win_vsync_int;
@ -109,8 +109,6 @@ module window_matcher(
always @(posedge clk) begin
if (rst == 1 || in_vsync == 0) begin
matcher_state <= ST_MAT_WAITING;
window_x <= 0;
window_y <= 0;
win_w_int <= 0;
win_h_int <= 0;
@ -119,8 +117,8 @@ module window_matcher(
ST_MAT_WAITING: begin
if (in_pxd_pattern_match) begin
matcher_state <= ST_MAT_RX0;
window_x <= scan_x_reg[2];
window_y <= scan_y;
win_x_int <= scan_x_reg[2];
win_y_int <= scan_y;
end
end
ST_MAT_RX0: begin
@ -142,8 +140,8 @@ module window_matcher(
win_hsync_int <= 1;
out_data_valid <= 1;
win_vsync_int <= 1;
win_hsync_ctr <= 9;
win_vsync_ctr <= 0;
win_hsync_ctr_int <= 9;
win_vsync_ctr_int <= 0;
end
endcase
end
@ -202,69 +200,132 @@ module window_matcher(
end
/* Match locking process */
reg [11:0] win_x;
reg [11:0] win_y;
reg match_locked; /* Goes high after a frame with a marker has been fully received */
always @(posedge clk) begin
if (rst) begin
match_locked <= 0;
win_locked <= 0;
win_w <= 0;
win_h <= 0;
win_x <= 0;
win_y <= 0;
end else begin
if (in_vsync_reg == 1 && in_vsync == 0) begin
match_locked <= matched;
win_locked <= matched;
win_w <= win_w_int;
win_h <= win_h_int;
if (matched) begin
win_w <= win_w_int;
win_h <= win_h_int;
win_x <= win_x_int;
win_y <= win_y_int;
end else begin
win_w <= 0;
win_h <= 0;
win_x <= 0;
win_y <= 0;
end
end
end
end
/* Window sync generator */
reg [11:0] win_hsync_ctr;
reg [11:0] win_vsync_ctr;
reg [11:0] win_hsync_ctr_int;
reg [11:0] win_vsync_ctr_int;
assign win_hsync = win_hsync_int && match_locked;
assign win_vsync = win_vsync_int && match_locked && in_vsync;
always @(posedge clk) begin
if (rst == 1) begin
win_hsync_int <= 0;
win_vsync_int <= 0;
win_hsync_ctr <= 0;
win_vsync_ctr <= 0;
win_hsync_ctr_int <= 0;
win_vsync_ctr_int <= 0;
out_data_valid <= 0;
end else begin
if (matcher_state == ST_MAT_DATA) begin
/* hsync */
if (scan_x == window_x && win_vsync_int == 1) begin
if (scan_x == win_x_int && win_vsync_int == 1) begin
win_hsync_int <= 1;
win_hsync_ctr <= 1;
win_hsync_ctr_int <= 1;
out_data_valid <= 1;
end
if (win_hsync_int == 1) begin
win_hsync_ctr <= win_hsync_ctr + 1;
win_hsync_ctr_int <= win_hsync_ctr_int + 1;
end
if (win_hsync_ctr == win_w_int || in_hsync_reg == 0) begin
if (win_hsync_ctr_int == win_w_int || in_hsync_reg == 0) begin
win_hsync_int <= 0;
out_data_valid <= 0;
win_hsync_ctr <= 0;
win_hsync_ctr_int <= 0;
end
if (in_hsync_reg == 1 && in_hsync == 0) begin
if (scan_y == window_y) begin
if (scan_y == win_y_int) begin
win_vsync_int <= 1;
win_vsync_ctr <= 0;
win_vsync_ctr_int <= 0;
end
win_vsync_ctr <= win_vsync_ctr + 1;
win_vsync_ctr_int <= win_vsync_ctr_int + 1;
end
if (win_vsync_ctr == win_h_int) begin
if (win_vsync_ctr_int == win_h_int) begin
win_vsync_int <= 0;
end
if (in_vsync_reg == 1 && in_vsync == 0) begin
win_vsync_ctr_int <= 0;
end
end
end
end
/* Window H/VSYNC outputs */
reg [11:0] win_hsync_ctr;
reg [11:0] win_vsync_ctr;
always @(posedge clk) begin
if (rst == 1) begin
win_hsync <= 0;
win_vsync <= 0;
win_hsync_ctr <= 0;
win_vsync_ctr <= 0;
end else begin
if (match_locked) begin
/* hsync */
if (scan_x == win_x && win_vsync == 1) begin
win_hsync <= 1;
win_hsync_ctr <= 1;
end
if (win_hsync == 1) begin
win_hsync_ctr <= win_hsync_ctr + 1;
end
if (win_hsync_ctr == win_w || in_hsync_reg == 0) begin
win_hsync <= 0;
win_hsync_ctr <= 0;
end
if (in_hsync_reg == 1 && in_hsync == 0 && win_vsync) begin
win_vsync_ctr <= win_vsync_ctr + 1;
end
if (scan_y == win_y) begin
win_vsync <= 1;
end
if (win_vsync_ctr == win_h) begin
win_vsync <= 0;
end
if (in_vsync_reg == 1 && in_vsync == 0) begin
win_vsync_ctr <= 0;
win_vsync <= 0;
end
end
end

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "peaceful-dream",
"id": "brilliant-stations",
"metadata": {},
"source": [
"# Window Matcher Testcase Generator"
@ -11,7 +11,7 @@
{
"cell_type": "code",
"execution_count": 67,
"id": "sustained-reservoir",
"id": "worth-faith",
"metadata": {},
"outputs": [],
"source": [
@ -32,7 +32,7 @@
{
"cell_type": "code",
"execution_count": 93,
"id": "modular-partnership",
"id": "removed-rugby",
"metadata": {},
"outputs": [],
"source": [
@ -121,7 +121,7 @@
{
"cell_type": "code",
"execution_count": 87,
"id": "yellow-affiliate",
"id": "specialized-reporter",
"metadata": {},
"outputs": [
{
@ -149,7 +149,7 @@
{
"cell_type": "code",
"execution_count": 94,
"id": "quick-proposition",
"id": "voluntary-chancellor",
"metadata": {},
"outputs": [],
"source": [
@ -173,7 +173,7 @@
{
"cell_type": "code",
"execution_count": 95,
"id": "usual-flash",
"id": "familiar-classification",
"metadata": {},
"outputs": [
{
@ -243,7 +243,7 @@
{
"cell_type": "code",
"execution_count": 54,
"id": "surrounded-devon",
"id": "signed-garden",
"metadata": {},
"outputs": [],
"source": [
@ -264,8 +264,8 @@
},
{
"cell_type": "code",
"execution_count": 96,
"id": "listed-addition",
"execution_count": 101,
"id": "packed-chapter",
"metadata": {},
"outputs": [
{
@ -313,7 +313,7 @@
"for (read_pos=0; read_pos<{{fb_len}}; read_pos=read_pos+1) begin\n",
" \n",
" if (!(win_hsync == 0)) $finish;\n",
" if (!(win_vsync == 0)) $finish;\n",
" if (!(!in_vsync || win_vsync == 0)) $finish;\n",
" if (!(in_blank == 1 || win_w == 0)) $finish;\n",
" if (!(in_blank == 1 || win_h == 0)) $finish;\n",
" if (!(!out_data_valid || out_data_en)) $finish;\n",
@ -348,12 +348,15 @@
"\n",
"for (read_pos=0; read_pos<{{fb_len}}; read_pos=read_pos+1) begin\n",
" if (read_pos > 0) begin\n",
" //if (!(win_hsync == {{mem}}[read_pos-1][{{ FLAG_WIN_HSYNC }}])) $finish;\n",
" //if (!(win_vsync == {{mem}}[read_pos-1][{{ FLAG_WIN_VSYNC }}])) $finish;\n",
" if (!(win_hsync == win_hsync_exp_last)) $finish;\n",
" /* Only check win_vsync aligns with expected value during win_hsync */\n",
" if (!(!win_hsync_exp_last || win_vsync == win_vsync_exp_last)) $finish;\n",
" end\n",
" \n",
" in_hsync = {{mem}}[read_pos][{{ FLAG_HSYNC }}];\n",
" in_vsync = {{mem}}[read_pos][{{ FLAG_VSYNC }}];\n",
" win_hsync_exp_last = win_hsync_exp;\n",
" win_vsync_exp_last = win_vsync_exp;\n",
" win_hsync_exp = {{mem}}[read_pos][{{ FLAG_WIN_HSYNC }}];\n",
" win_vsync_exp = {{mem}}[read_pos][{{ FLAG_WIN_VSYNC }}];\n",
" win_header = {{mem}}[read_pos][{{ FLAG_WIN_HEADER }}];\n",
@ -390,7 +393,7 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "protected-bronze",
"id": "sunset-saturday",
"metadata": {},
"outputs": [],
"source": [
@ -402,7 +405,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "unknown-framing",
"id": "induced-tenant",
"metadata": {},
"outputs": [
{
@ -425,7 +428,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "political-blink",
"id": "serious-advice",
"metadata": {},
"outputs": [
{
@ -448,7 +451,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "intelligent-locator",
"id": "comparative-passion",
"metadata": {},
"outputs": [
{
@ -486,7 +489,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "breeding-representation",
"id": "greatest-duration",
"metadata": {},
"outputs": [
{
@ -526,7 +529,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "duplicate-riverside",
"id": "mysterious-michigan",
"metadata": {},
"outputs": [
{
@ -566,7 +569,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "homeless-posting",
"id": "numerical-result",
"metadata": {},
"outputs": [
{

View file

@ -11,15 +11,15 @@
</db_ref>
</db_ref_list>
<zoom_setting>
<ZoomStartTime time="5259263400fs"></ZoomStartTime>
<ZoomEndTime time="5259393751fs"></ZoomEndTime>
<Cursor1Time time="5259364000fs"></Cursor1Time>
<ZoomStartTime time="5693629750fs"></ZoomStartTime>
<ZoomEndTime time="5694933251fs"></ZoomEndTime>
<Cursor1Time time="5694716000fs"></Cursor1Time>
</zoom_setting>
<column_width_setting>
<NameColumnWidth column_width="175"></NameColumnWidth>
<ValueColumnWidth column_width="166"></ValueColumnWidth>
</column_width_setting>
<WVObjectSize size="50" />
<WVObjectSize size="54" />
<wvobject fp_name="/window_matcher_tb/window_matcher_i/clk" type="logic">
<obj_property name="ElementShortName">clk</obj_property>
<obj_property name="ObjectShortName">clk</obj_property>
@ -68,16 +68,16 @@
<obj_property name="ElementShortName">out_green[7:0]</obj_property>
<obj_property name="ObjectShortName">out_green[7:0]</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/out_blue" type="array">
<obj_property name="ElementShortName">out_blue[7:0]</obj_property>
<obj_property name="ObjectShortName">out_blue[7:0]</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_hsync" type="logic">
<obj_property name="ElementShortName">win_hsync</obj_property>
<obj_property name="ObjectShortName">win_hsync</obj_property>
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
<obj_property name="UseCustomSignalColor">true</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/out_blue" type="array">
<obj_property name="ElementShortName">out_blue[7:0]</obj_property>
<obj_property name="ObjectShortName">out_blue[7:0]</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_hsync_int" type="logic">
<obj_property name="ElementShortName">win_hsync_int</obj_property>
<obj_property name="ObjectShortName">win_hsync_int</obj_property>
@ -156,19 +156,25 @@
<obj_property name="ObjectShortName">scan_y[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/window_x" type="array">
<obj_property name="ElementShortName">window_x[11:0]</obj_property>
<obj_property name="ObjectShortName">window_x[11:0]</obj_property>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_x" type="array">
<obj_property name="ElementShortName">win_x[11:0]</obj_property>
<obj_property name="ObjectShortName">win_x[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
<obj_property name="CustomSignalColor">#00FF7F</obj_property>
<obj_property name="UseCustomSignalColor">true</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/window_y" type="array">
<obj_property name="ElementShortName">window_y[11:0]</obj_property>
<obj_property name="ObjectShortName">window_y[11:0]</obj_property>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_y" type="array">
<obj_property name="ElementShortName">win_y[11:0]</obj_property>
<obj_property name="ObjectShortName">win_y[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_x_int" type="array">
<obj_property name="ElementShortName">win_x_int[11:0]</obj_property>
<obj_property name="ObjectShortName">win_x_int[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_y_int" type="array">
<obj_property name="ElementShortName">win_y_int[11:0]</obj_property>
<obj_property name="ObjectShortName">win_y_int[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
<obj_property name="CustomSignalColor">#00FF7F</obj_property>
<obj_property name="UseCustomSignalColor">true</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_w_int" type="array">
<obj_property name="ElementShortName">win_w_int[11:0]</obj_property>
@ -195,11 +201,21 @@
<obj_property name="ObjectShortName">win_hsync_ctr[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_hsync_ctr_int" type="array">
<obj_property name="ElementShortName">win_hsync_ctr_int[11:0]</obj_property>
<obj_property name="ObjectShortName">win_hsync_ctr_int[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_vsync_ctr" type="array">
<obj_property name="ElementShortName">win_vsync_ctr[11:0]</obj_property>
<obj_property name="ObjectShortName">win_vsync_ctr[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/win_vsync_ctr_int" type="array">
<obj_property name="ElementShortName">win_vsync_ctr_int[11:0]</obj_property>
<obj_property name="ObjectShortName">win_vsync_ctr_int[11:0]</obj_property>
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
</wvobject>
<wvobject fp_name="/window_matcher_tb/window_matcher_i/matcher_state" type="array">
<obj_property name="ElementShortName">matcher_state[5:0]</obj_property>
<obj_property name="ObjectShortName">matcher_state[5:0]</obj_property>