Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Content in ROM

Hi guys.

I am having problem with my assignment. In my assignment I have ROM. I have used lpm rom in megawizard and load the .mif file. I want to check the content in my ROM exactly same with my expect. I am not sure either this waveform is show the correct same as content in my ROM. The content in my ROM have value 0 and 128. For address 0=> 128. Address 1=> 128. Could somebody help me either my waveform is same as mif file or not? And I want to display on VGA monitor with defining if the value is 128, the color display is white. While if the value is 0, the color is black. How can I do that?

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It would help if you showed some code

    Is the .mif file correct and formatted correctly?

    Have you got a VGA controller?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks Tricky for your respond.

    Yes. I already did the .mif file. The .mif file contained decimal number 128 and 0. I already got the VGA controller. Here is my coding. The problem is the FPGA seems not read in this part "IF (Q = "10000000")". It only display black color which is in when Q=0. I define when Q =128 (decimal) the RGB will set as white color and when Q = 0, the RGB will set as black color.

    LIBRARY ieee;

    USE ieee.std_logic_1164.all;

    ENTITY hw_image_generator IS

    GENERIC(

    pixels_y : INTEGER := 478; --row that first color will persist until

    pixels_x : INTEGER := 478); --column that first color will persist until

    PORT(

    disp_ena : IN STD_LOGIC; --display enable ('1' = display time, '0' = blanking time)

    row : IN INTEGER; --row pixel coordinate

    column : IN INTEGER; --column pixel coordinate

    red : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); --red magnitude output to DAC

    green : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); --green magnitude output to DAC

    blue : OUT STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0'); --blue magnitude output to DAC

    Q : in std_logic_vector (7 downto 0));

    END hw_image_generator;

    ARCHITECTURE behavior OF hw_image_generator IS

    begin

    PROCESS(disp_ena, row, column, Q)

    BEGIN

    IF(disp_ena = '1') THEN --display time

    IF(row < pixels_y AND column < pixels_x) THEN

    IF (Q = "10000000") THEN

    red <= (OTHERS => '1');----white

    green <= (OTHERS => '1') ;---white

    blue <= (OTHERS => '1');---white

    ELSE

    red <= (OTHERS => '0');

    green <= (OTHERS => '0') ;

    blue <= (OTHERS => '0');

    END IF;

    ELSE

    red <= (OTHERS => '0');

    green <= (OTHERS => '1');

    blue <= (OTHERS => '0');

    END IF;

    ELSE --blanking time

    red <= (OTHERS => '0');

    green <= (OTHERS => '1');

    blue <= (OTHERS => '0');

    END IF;

    END PROCESS;

    END behavior;
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No I am still not have testbench. Should I have it? Sorry if the question seems stupid. Thanks for your respond.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you had a testbench, debugging would be much simpler and quicker.