//////////////////////////////////////////////////////////////////////
//
// rblob: generate a "round" blob screen; hardcoded to 32 pixel
//            radius as proof of concept
// rx, ry = upper left corner of square around the circle
//
//////////////////////////////////////////////////////////////////////
module rblob(

input clk,
input [5:0] radius,
input [10:0] x,hcount,
input [9:0] y,vcount,
output reg [11:0] pixel
);



parameter COLOR = 12'b110_000_000;
reg [11:0] rsquared;
reg [13:0] xsq, ysq;

// make sure difference is positive number
wire [10:0] x1 = ((x + radius) > hcount+2) ? (x + radius - hcount -2) : (hcount +2 - x - radius);
wire [9:0] y1 = ((y +radius) > vcount) ? (y + radius- vcount) : (vcount - y -radius);

always @(posedge clk) begin

rsquared <= radius * radius;
xsq <= x1*x1;
ysq <= y1*y1;

if ((x1<radius) && (y1<radius))
	begin
	//if (((x1 * x1) + (y1 * y1)) < radius * radius)     // 1024 = 32 ^2
	if ((xsq + ysq) <rsquared)
	
	  pixel <= COLOR;
	else pixel <= 0;
	end
	else pixel <= 0;
//else pixel = 0;
end
endmodule


