A Color Vision System for Embedded Robotics Applications

Click here to return to article

FPGA Verilog Code, "Video Ranging"

////////////////////////////////////////////////////////////////////
//
//  Laser Range Finding Function
//
////////////////////////////////////////////////////////////////////
//  Copyright (C), Kenneth Y Maxon Sept, 2004.

module video_ranging(
			input sys_clock,
			input [8:0] pixel_count,
			input [7:0] line_count,
			input video_store_strobe,
			input laser_valid,
			input video_capture_running,
			input [8:0] range_read_address,
			output [7:0] range_data_out
			);

wire [8:0] muxed_addr;
wire range_store_strobe;

assign #1 muxed_addr[8:0] = video_capture_running ?
			pixel_count[8:0] : range_read_address[8:0];

assign #1 range_store_strobe = ((video_store_strobe && (line_count[7:0] == 8'h00))
			|| (video_store_strobe && laser_valid));

////////////////////////////////////////////////////////////////////
//
//  this launches out a 512x8 block RAM
//

RAMB4_S8 my_ranging_mem (
			.WE(range_store_strobe),
			.EN(1'b1),
			.RST(1'b0),
			.CLK(sys_clock),
			.ADDR(muxed_addr[8:0]),
			.DI(line_count[7:0]),
			.DO(range_data_out[7:0])
			); 

endmodule

Click here to return to article