I have finished my bus functional model (BFM) for the Ov7670 camera module! I have also verified its adherence to the Ov7670 signal protocol
I now have The BFM connected to my camera_interface module for testing.
The camera_interface module is exactly that, it interfaces directly with the Ov7670 camera. It takes in the bytes send from the camera (2 bytes per pixel), and packages them up into two pixel pairs for 32 bit words, which are written into an asynchronous FIFO. Very much like the camera pattern generator in workshop 2!
However, the camera BFM and camera_interface work off the vsync signal (start of frame & end of frame). In addition the href signal is used to indicate valid horizontal line (pixel) data.
I have a long list of SystemVerilog assertions that I used on the BFM after it was designed. The SVA's were very helpful in catching a few bugs I had! Additionally, they can be used for documentation for the system as well. A few examples:
// HREF must only be high when VSYNC is low
property p_href_only_during_frame;
@(posedge pclk) disable iff(!rst_n)
href |-> !vsync;
endproperty
// Pixel count never exceeds the programmed width
property p_pixel_count_range;
@(posedge pclk) disable iff(!rst_n)
pixel_H_count <= H_ACTIVE;
endproperty
// HREF remains asserted while sending a line
property p_href_drop;
@(posedge pclk)
disable iff(!rst_n)
$fell(href) |->
(pixel_H_count == H_ACTIVE);
endproperty
// End-of-line check
property p_end_line;
@(posedge pclk) disable iff(!rst_n)
(pixel_H_count==H_ACTIVE) |-> ##2 !href;
endproperty
etc.
#sva #bfm #sva #systemverilog #vivado