Skip to content
Snippets Groups Projects
Commit d6bad8c3 authored by Fang Lu's avatar Fang Lu
Browse files

polygon - shorten combinational logic

Registered output
parent e024d805
No related branches found
No related tags found
No related merge requests found
......@@ -41,10 +41,12 @@ module gl_painter_polygon (
// Inclined line scanner instances
logic [9:0] l_x1, l_y1, l_x2, l_y2, r_x1, r_y1, r_x2, r_y2;
logic l_side, r_side;
gl_line_scanner scanner_left(.X({6'h0, x}), .Y({6'h0, y}), .SIDE(l_side),
.X1({6'h0,l_x1}), .Y1({6'h0,l_y1}), .X2({6'h0,l_x2}), .Y2({6'h0,l_y2}));
gl_line_scanner scanner_right(.X({6'h0, x}), .Y({6'h0, y}), .SIDE(r_side),
.X1({6'h0,r_x1}), .Y1({6'h0,r_y1}), .X2({6'h0,r_x2}), .Y2({6'h0,r_y2}));
gl_line_scanner scanner_left(.X({6'h0, x}), .Y({6'h0, y}),
.SIDE(l_side), .X1({6'h0,l_x1}), .Y1({6'h0,l_y1}),
.X2({6'h0,l_x2}), .Y2({6'h0,l_y2}), .CLOCK(CLOCK));
gl_line_scanner scanner_right(.X({6'h0, x}), .Y({6'h0, y}),
.SIDE(r_side), .X1({6'h0,r_x1}), .Y1({6'h0,r_y1}),
.X2({6'h0,r_x2}), .Y2({6'h0,r_y2}), .CLOCK(CLOCK));
// Midpoint tracking
logic [9:0] l_lim, l_lim_in, r_lim, r_lim_in, xbeg, xbeg_in;
......
module gl_line_scanner (
input logic CLOCK,
input logic signed [15:0] X1, Y1, X2, Y2,
input logic signed [15:0] X, Y,
output logic SIDE
);
logic signed [31:0] prod1, prod2 /*synthesis keep*/;
logic signed [31:0] prod1, prod2;
assign prod1 = (X-X1) * (Y2-Y1);
assign prod2 = (Y-Y1) * (X2-X1);
assign SIDE = (prod1 - prod2)>0;
always_ff @(posedge CLOCK) begin
SIDE <= (prod1 - prod2)>0;
end
endmodule
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment