2009ǯ12·î09Æü

ModelSim¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥ê¡¼¥É¥é¥¤¥È¡Ê´°À®¡Ë

°ÊÁ°¡¢¡ÖModelSim¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥ê¡¼¥É¥é¥¤¥È¡×¤Ç¾Ò²ð¤·¤¿¥â¥¸¥å¡¼¥ë¤¬¤ä¤Ã¤È´°À®¤·¤¿¡£
¤³¤ì¤ò»È¤¨¤Ð´Êñ¤Ë¥Ó¥Ã¥È¥Þ¥Ã¥×¤ò¥Æ¥¹¥È¥Ù¥¯¥¿¤È¤·¤ÆÍøÍѤǤ­¤ë¤Î¤Ç²èÁü½èÍý¤Ê¤ó¤«¤Ë¤ÏÊØÍø¤À¤È»×¤¦¡£
¤Þ¤¿¡¢£Æ£Ì£ÉÅù¤Ï»È¤ï¤º£Ö£È£Ä£Ì¤Îµ­½Ò¤À¤±¤Ç¼Â¸½¤·¤Æ¤¤¤ë¤Î¤Ç½¤Àµ¤â½ÐÍè¤ë¤·±þÍѤâ½ÐÍè¤ë¡£
¤È¤¤¤¦»ö¤Ç¡¢Â¾¤Î¿Í¤Ë¤â»È¤Ã¤ÆÌ㤨¤ì¤Ð¤È»×¤¦¤Î¤Ç¥½¡¼¥¹¥³¡¼¥É¤ò¸ø³«¤·¤Þ¤¹¡£

¥À¥¦¥ó¥í¡¼¥É

Æ°ºî´Ä¶­
£Ï£Ó¡§Windows·Ï
¥·¥ß¥å¥ì¡¼¥¿¡§ModelSim¡ÊXE¤Ç¤âÂç¾æÉפÀ¤È»×¤¦¡Ë

»ÈÍÑÊýË¡
¾åµ­´Ä¶­¤Ç¡¢ModelSim¤ËPath¤¬Ä̤äƤ¤¤ì¤Ð¡¢²òÅष¤¿¥Õ¥¡¥¤¥ë¤Î¡Ösim.bat¡×¤ò¼Â¹Ô¤¹¤ì¤Ð¥µ¥ó¥×¥ë¤¬Æ°¤­¤Þ¤¹¡£
¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¢²òÅष¤¿¥Õ¥¡¥¤¥ë¤Î¡Öread.bmp¡×¤òÆɤ߽Ф·¥Ô¥¯¥»¥ë¥Ç¡¼¥¿¤òȿž¤·¤Æ¡Öwrite.bmp¡×¤Ë½ñ¤­¹þ¤à¤À¤±¤Ç¤¹¡£
¸å¤ÏŬÅö¤Ë¥½¡¼¥¹¥³¡¼¥É¤ò¸«¤Æ²¼¤µ¤¤¡£

¥É¥­¥å¥á¥ó¥È¤¬¾¯¤Ê¤¤¤Î¤Ç¿½¤·Ìõ¤Ê¤¤¤¬Í×˾¤¬¤¢¤ì¤ÐÀ°È÷¤·¤Þ¤¹¡£



2007ǯ10·î02Æü

VHDL TIPS ¡ÖʪÍý¥¿¥¤¥×¤Î»È¤¤Êý¡×

ʪÍý¥¿¥¤¥×¤È¤Ï¡¢»þ´Ö¤äÅÅ°µ¡¢ÅÅή¡¢µ÷Î¥¤Ê¤É¤ÎʪÍýŪ¤Êʪ¤òɽ¤¹¤¿¤á¤Ë»ÈÍѤ¹¤ë¥Ç¡¼¥¿¥¿¥¤¥×¤À¡£
£Ö£È£Ä£Ì¤Ë¤Ï¸µ¡¹¡Ö£ô£é£í£å¡×¤¬ÊªÍý¥¿¥¤¥×¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤ª¤êÆâÍƤϥ¹¥¿¥ó¥À¡¼¥É¥Ñ¥Ã¥±¡¼¥¸¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¡£
¤³¤Î¡Ö£ô£é£í£å¡×¤òÂåɽ¤È¤¹¤ëʪÍý¥¿¥¤¥×¤Ï£ð£ó¤ä£î£ó¤Ê¤É¤Îñ°Ì¤ò»ØÄê¤Ç¤­¤ë¤Î¤¬Â礭¤ÊÆÃħ¤Ç¡¢¿·¤·¤¤Ã±°Ì¤ò»ý¤Ã¤¿¥Ç¡¼¥¿¥¿¥¤¥×¤òºîÀ®¤¹¤ë»ö¤â½ÐÍè¤ë¡£

°Ê²¼¤ÎÎã¤Ïµ÷Î¥¤ÎʪÍý¥¿¥¤¥×¤ò¿·¤¿¤ËÄêµÁ¤·¤Æ¡¢¤½¤Îµ÷Î¥¤òÃÙ±ä»þ´Ö¤ËÊÑ´¹¤¹¤ë´Ø¿ô¤âÍÑ°Õ¤·¤¿¡£¡ÊÃÙ±ä»þ´Ö¤Ï£±£î£ó¡á£±£µ£ã£í¤Ç·×»»¡Ë


library modelsim_lib;
use modelsim_lib.util.all;

package distance_pkg is

    -- µ÷Î¥¥¿¥¤¥×
    type distance is range 0 to integer'high
        units
            munit;

            um      = 10 munit;
            mm      = 1000 um;
            cm      = 10 mm;
            m       = 100 cm;
            km      = 1000 m;

            mil     = 254 munit;
            inch    = 1000 mil;
            ft      = 12 inch;
            yd      = 3 ft;
            fm      = 6 ft;
            mi      = 5280 ft;
            lg      = 3 mi;
        end units;

    -- µ÷Î¥¤«¤éÃÙ±ä»þ´Ö¤ò»»½Ð
    function distance2time( trace_len : distance ) return time;

end distance_pkg;

package body distance_pkg is

    -- µ÷Î¥¤«¤éÃÙ±ä»þ´Ö¤ò»»½Ð
    function distance2time( trace_len : distance ) return time is
        variable    resolution      : real;
        variable    delay_time      : time;
    begin
        -- ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Î¼èÆÀ
        resolution := get_resolution;

        -- ¥á¡¼¥È¥ë¡Ý»þ´ÖÊÑ´¹
        --1ns=15cm(150000um)
        --1000000fs=150000um
        --1fs=0.15um(1.5munit)
        delay_time := to_time( real( distance'pos(trace_len))
                                 /(1.5 * resolution * 1000000000000000.0));

        return delay_time;
    end;

end distance_pkg;


¤³¤Î¤è¤¦¤ËºÇ¾®Ã±°Ì¤«¤é¤Î·¸¿ô¤òÊѤ¨¤ë¤³¤È¤Ç¡¢¥ß¥ê¤ä¥¤¥ó¥Á¤Ê¤É¤òº®ºß¤·¤Æµ­½Ò½ÐÍè¤ë»ö¤âÊØÍø¤ÊÅÀ¤À¡£
¤Þ¤¿¡¢µ÷Î¥¤òÃÙ±ä»þ´Ö¤ËÊÑ´¹¤¹¤ë´Ø¿ô¤Ï¡¢¡Ö£ô£é£í£å¡×¤¬¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¤è¤Ã¤ÆºÇ¾®Ã±°Ì¤¬ÊѤï¤ëÆüì¤ÊʪÍý¥¿¥¤¥×¤Î¤¿¤á¡¢¤Þ¤º¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤ò¼èÆÀ¤·¤Æ¤«¤éÊÑ´¹¤·¤Æ¤¤¤ë¡£

¤³¤Îµ÷Î¥¥Ñ¥Ã¥±¡¼¥¸¤ò»È¤¦¤È¡¢°ÊÁ°¾Ò²ð¤·¤¿VHDL TIPS ¡ÖÁÐÊý¸þ¥Ð¥¹¤ÎÃÙ±ä¥â¥Ç¥ë¡×¤ÎÃÙ±äÃͤòÆþÎϤ¹¤ëÉôʬ¤ò¡¢µ÷Î¥¤òÆþÎϤ¹¤ëÍͤ˴Êñ¤ËÃÖ¤­´¹¤¨¤ë¤³¤È¤¬½ÐÍè¤ë¤Î¤Ç¡¢¥±¡¼¥Ö¥ë¤Î¥â¥Ç¥ê¥ó¥°¤Ê¤É¤Ë»ÈÍѤ¹¤ë¤È¤ª¤â¤·¤í¤¤¤È»×¤¦¡£



Åê¹Æ»þ¹ï(08:58)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ09·î26Æü

VHDL TIPS ¡ÖÁÐÊý¸þ¥Ð¥¹¤ÎÃÙ±ä¥â¥Ç¥ë¡×

£Æ£Ð£Ç£Á¤È¥á¥â¥ê¥â¥Ç¥ë¤òÀܳ¤¹¤ë¾ì¹çÅù¤Ë¡ÖÁÐÊý¸þ¥Ð¥¹¤Ç¥Í¥Ã¥È¤ÎÃÙ±ä¤òÁÞÆþ¤·¤¿¤¤¡×¤È»×¤Ã¤¿»ö¤¬²¿ÅÙ¤«¤¢¤ë¡£
°Âľ¤Ë¡Öafterʸ¡×¤Ç¤ª¸ß¤¤¤òÂåÆþ¤·¤Æ¤â'X'¤Ë¤Ê¤Ã¤¿°Ê¹ß¤Ï¤º¤Ã¤È'X'¤Î¤Þ¤Þ¤Ç¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¡£
¤Ç¤Ï¤É¤¦¤¹¤ì¤ÐÁÐÊý¸þ¥Ð¥¹¤ËÃÙ±ä¤òÁÞÆþ¤¹¤ë»ö¤¬½ÐÍè¤ë¤Î¤À¤í¤¦¤«¡©
´Êñ¤ÊÍͤǡ¢¤³¤ì¤¬·ë¹½Æñ¤·¤¤¡£¿§¡¹¤È¹Í¤¨¤¿Ëö¤Ë¡¢ÁÐÊý¸þ¥Ð¥¹¤ÎÃÙ±ä¥â¥Ç¥ë¤òºîÀ®¤Ç¤­¤¿¤Î¤Ç¾Ò²ð¤¹¤ë¡£

¤Þ¤º¤Ï¡¢¥â¥Ç¥ë¤ÎÆ°ºî¤ò³Îǧ¤·¤¿²óÏ©¡£
ÁÐÊý¸þ¤ÎÃÙ±ä¥â¥Ç¥ë¤À¤¬¡¢¥Æ¥¹¥È¤ÇÆþÎϤϻÈÍѤ·¤Ê¤¤¤Î¤Ç½ÐÎϤΤߤòÆþ¤ì¤¿¡£
¤³¤ÎPORTA¤ÈPORTB¤ËÂФ·¤Æ¥Æ¥¹¥È¥Ù¥ó¥Á¤«¤éÇÈ·Á¤òÆþÎϤ¹¤ë¡£

linedelay_c

 



ÇÈ·Á¤òÆþÎϤ¹¤ë¥Æ¥¹¥È¥Ù¥ó¥Á¤Ï¤³¤ì¡£


library IEEE;
use IEEE.std_logic_1164.all;

entity TEST is
end TEST;

architecture BEHAVIOR of TEST is

    component LINEDELAY
        generic
        (
            linedelay       : time
        );
        port
        (
            PORTA           : inout std_logic;
            PORTB           : inout std_logic
        );
    end component;

    signal  PORTA   : std_logic;
    signal  PORTB   : std_logic;
    signal  PORTA_S : std_logic;
    signal  PORTB_S : std_logic;

begin

    C_LINEDELAY : LINEDELAY
    generic map
    (
        linedelay       => 10 ns
    )
    port map
    (
        PORTA           => PORTA_S,
        PORTB           => PORTB_S
    );

    process begin
        PORTA <= 'Z';
        PORTB <= 'Z';
        wait for 100 ns;
        PORTA <= '1';
        wait for 100 ns;
        PORTA <= '0';
        wait for 100 ns;
        PORTA <= 'Z';
        PORTB <= '1';
        wait for 100 ns;
        PORTB <= '0';
        wait for 100 ns;
        PORTB <= 'Z';
        wait for 100 ns;
        PORTA <= '1';
        PORTB <= '0';
        wait for 100 ns;
        PORTA <= '0';
        PORTB <= '1';
        wait for 100 ns;
        PORTA <= '1';
        wait for 100 ns;
        PORTA <= '0';
        PORTB <= '0';
        wait for 100 ns;
    end process;

    PORTA_S <= PORTA;
    PORTB_S <= PORTB;

end BEHAVIOR;


¤½¤·¤ÆÆ°ºî·ë²Ì¤ÎÇÈ·Á¤Ï¤³¤ó¤Ê´¶¤¸¡£

linedelay_w

 

PORTA¤«¤é½ÐÎϤ·¤¿Ãͤϡ¢¤¹¤°¤ËPORTA_S¤ËÈ¿±Ç¤µ¤ì¤ë¤¬PORTB_S¤Ë¤ÏÃٱ䤬Æþ¤Ã¤Æ¤¤¤ë»ö¤¬Ê¬¤«¤ë¡£
µÕ¤ËPORTB¤«¤é½ÐÎϤ·¤¿Ãͤϡ¢¤¹¤°¤ËPORTB_S¤ËÈ¿±Ç¤µ¤ì¤ë¤¬PORTA_S¤Ë¤ÏÃٱ䤬Æþ¤Ã¤Æ¤¤¤ë¡£
¤Þ¤¿¡¢Æ±»þ¤ËPORTA_S¤ÈPORTB_S¤ÎÃͤòÊѲ½¤µ¤»¤Æ¤âÃÙ±ä»þ´Öʬ¤Î¥·¥ç¡¼¥È¤¬'X'¤ÇºÆ¸½¤µ¤ì¤Æ¤¤¤ë¡£

¼¡¤Ë´Î¿´¤Ê¥â¥Ç¥ë¤Î¥½¡¼¥¹¤¬¤³¤ì¡£


library IEEE;
use IEEE.std_logic_1164.all;

entity LINEDELAY is
    generic
    (
        linedelay       : time
    );
    port
    (
        PORTA           : inout std_logic;
        PORTB           : inout std_logic
    );
end LINEDELAY;

architecture BEHAVIOR of LINEDELAY is

    signal  PORTA_X     : std_logic;
    signal  PORTB_X     : std_logic;

begin

    PROCESS
        VARIABLE last_time : time;
        VARIABLE transact : boolean;
    BEGIN
            WAIT ON PORTA'TRANSACTION, PORTB_X UNTIL (last_time /= NOW or PORTB_X'EVENT);

            if ( PORTA'TRANSACTION'EVENT ) then
                PORTA <= 'Z';
                transact := TRUE;
                last_time := NOW;
            else
                transact := FALSE;
            end if;

            WAIT FOR 0 ns;

            if ( transact = TRUE ) then
                PORTA_X <= transport PORTA after linedelay;
            end if;
            PORTA <= PORTB_X;

    END PROCESS;

    PROCESS
        VARIABLE last_time : time;
        VARIABLE transact : boolean;
    BEGIN
            WAIT ON PORTB'TRANSACTION, PORTA_X UNTIL (last_time /= NOW or PORTA_X'EVENT);

            if ( PORTB'TRANSACTION'EVENT ) then
                PORTB <= 'Z';
                last_time := NOW;
                transact := TRUE;
            else
                transact := FALSE;
            end if;

            WAIT FOR 0 ns;

            if ( transact = TRUE ) then
                PORTB_X <= transport PORTB after linedelay;
            end if;
            PORTB <= PORTA_X;

    END PROCESS;

end BEHAVIOR;


PORTA_X¤ÈPORTB_X¤Ë¡¢¤½¤ì¤¾¤ì¤ÎÁÐÊý¸þ¥Ý¡¼¥È¤ÎÃͤò¥³¥Ô¡¼¤·¡¢¤½¤ì¤òÃٱ䤵¤»¤ÆÈ¿ÂЦ¤Î¥Ý¡¼¥È¤ËÂåÆþ¤·¤Æ¤¤¤ë¡£
¤³¤ÎÁÐÊý¸þ¥Ý¡¼¥È¤ÎÃͤò¥³¥Ô¡¼¤¹¤ë»þ¡¢°ìÅÙ¥â¥Ç¥ë¦¤Î¥É¥é¥¤¥Ð¤ò'Z'¤Ë¤·¤ÆËÜÅö¤ÎÁê¼ê¦¥Ý¡¼¥È¤ÎÃͤò¼èÆÀ¤¹¤ëɬÍפ¬¤¢¤ë¡£
¤Þ¤¿¡¢ÊѤʡÖWAITʸ¡×¡¢¤³¤ì¤ÏÁÐÊý¸þ¥Ý¡¼¥È¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Ï»þ´Öñ°Ì¤¢¤¿¤ê£±ÅÙ¤·¤«Æ°ºî¤µ¤»¤¿¤¯Ìµ¤¤¤Î¤ËÂФ·È¿ÂЦ¤ÎÁÐÊý¸þ¥Ý¡¼¥È¤ò¥³¥Ô¡¼¤·¤¿ÃͤΥ¤¥Ù¥ó¥È¤Ï²¿²ó¤Ç¤âÆ°ºî¤µ¤»¤ë¤¿¤á¤Î¾ò·ï¤À¡£
ÁÐÊý¸þ¥Ý¡¼¥È¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ò»þ´Öñ°Ì¤¢¤¿¤ê£±ÅÙ¤·¤«Æ°ºî¤µ¤»¤¿¤¯¤Ê¤¤Íýͳ¤Ï¡¢¼«Ê¬¤Ç¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤òȯÀ¸¤µ¤»¤Æ¤¤¤ë¤¿¤á¤³¤Î¾ò·ï¤¬Ìµ¤¤¤È¥ë¡¼¥×¤Ë´Ù¤Ã¤Æ¤·¤Þ¤¦¤«¤é¤Ç¤¢¤ë¡£
¤¿¤À¡¢ÁÐÊý¸þ¥Ý¡¼¥È¤Î°ìÈֺǽé¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÇÆ°ºî¤µ¤»¤Æ¤¤¤ë¤¿¤á¡¢¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤¬È¯À¸¤·¤¿¥Ç¥ë¥¿»þ´Ö¤Î¸å¤Î¥Ç¥ë¥¿»þ´Ö¤ËÃͤ¬ÊѲ½¤¹¤ë¤è¤¦¤Ê¿®¹æ¤Ç¤Ï¤¦¤Þ¤¯Æ°ºî¤·¤Ê¤¤¡£
¾°¡¢°ÊÁ°¾Ò²ð¤·¤¿VHDL TIPS ¡Ö¥¢¥Ê¥í¥°¥¹¥¤¥Ã¥Á¤Î¥â¥Ç¥ê¥ó¥°¡×¤â¤½¤¦¤À¤¬¡¢¤³¤Î¼ê¤Î¼êË¡¤Ï¤³¤ÎÀ©¸Â¤¬¤Ä¤­¤Þ¤È¤Ã¤Æ¤·¤Þ¤¦¡£



Åê¹Æ»þ¹ï(21:44)¨¢¥³¥á¥ó¥È(3)¨¢VHDL 

2007ǯ09·î21Æü

VHDL TIPS ¡Ö°À­"DRIVING_VALUE"¤Î»ÈÍÑË¡¡×

£Ö£È£Ä£Ì¤Ç¤Ï½ÐÎϥݡ¼¥È¤Ë³ä¤êÅö¤Æ¤¿ÃͤòÆâÉô¤Ç»²¾È¤¹¤ë»ö¤Ï½ÐÍè¤Ê¤¤¡£
½ê¤¬¡¢£Ö£È£Ä£Ì£¹£³¤Ç¥³¥ì¤ò²Äǽ¤Ë¤¹¤ë¥¢¥È¥ê¥Ó¥å¡¼¥È¡ÖDRIVING_VALUE¡×¤¬Äɲ䵤줿¡£

°Ê²¼¤Ë»ÈÍÑÎã¤ò¾Ò²ð¤¹¤ë¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_signed.all;

entity COUNT is
    port
    (
        CLK     : in    std_logic;
        COUNT   : out   std_logic_vector(7 downto 0) := (others => '0')
    );
end COUNT;

architecture rtl of COUNT is

begin

    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            COUNT <= COUNT'DRIVING_VALUE + '1';        -- ÆâÉô»²¾È
        end if;
    end process;

end rtl;


¤³¤ì¤Ïñ½ã¤Ê£¸¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿¤Ç¡¢¥¯¥í¥Ã¥¯¤òÆþÎϤ¹¤ë¤È¥«¥¦¥ó¥È¥¢¥Ã¥×¤¹¤ë¤À¤±¤Î²óÏ©¤À¡£Ä̾ï¤ÏÆâÉô¤Ë¥«¥¦¥ó¥È¿®¹æ¤òÄêµÁ¤·¤Æ¤½¤Î¿®¹æ¤ò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¡¢½ÐÎϥݡ¼¥È¤Ë³ä¤êÅö¤Æ¤ë¤è¤¦¤Êµ­½Ò¤Ë¤Ê¤ë¤È»×¤¦¤¬¡ÖDRIVING_VALUE¡×¤ò»ÈÍѤ¹¤ë¤È½ÐÎϥݡ¼¥È¤ÎÃͤòľÀÜ»²¾È¤·¤Æ¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¡¢¤½¤Î¤Þ¤Þ½ÐÎϥݡ¼¥È¤ËÂåÆþ¤¹¤ë»ö¤¬½ÐÍè¤ë¡£

ÊØÍø¤È¸À¤¨¤ÐÊØÍø¤À¤¬¡¢¼«Ê¬¤Ï½ÐÎϥݡ¼¥È¤Ë½Ð¤Æ¤¤¤ë¿®¹æ¤ÏÆâÉô»²¾È¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤òÁ°Äó¤Ë¥½¡¼¥¹¥³¡¼¥É¤òÄɤ¤¤«¤±¤ë¤Î¤Ç¡¢½ÐÍè¤ë¤À¤±»ÈÍѤ·¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤¤¤ë¡£
¤Þ¤¿¡¢»ÈÍѤ·¤Ê¤¤·èÄêŪ¤ÊÍýͳ¤È¤·¤Æ¡¢£Ø£Ó£Ô¤Ç¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¤È¸À¤¦»ö¤¬¤¢¤ë¡£

¤½¤ì¤Ç¤â¡¢¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥â¥Ç¥ëÅù¤Ç½ÐÎϥݡ¼¥È¤òľÀÜ¥Á¥§¥Ã¥¯¤·¤¿¤¤»þ¤Ë¤ÏÊØÍø¤Ë»È¤¨¤ë¤«¤â¤·¤ì¤Ê¤¤¡£



Åê¹Æ»þ¹ï(21:34)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ09·î11Æü

VHDL TIPS ¡Öshared variable¤Î»ÈÍÑË¡¡×

£Ö£È£Ä£Ì£¹£³¤«¤é¡Ö¶¦Í­ÊÑ¿ô¡×¤¬»ÈÍѲÄǽ¤Ë¤Ê¤ê£Ö£È£Ä£Ì£²£°£°£²¤Ç»ÈÍÑÊýË¡¤¬Êѹ¹¤Ë¤Ê¤Ã¤¿¡£
£Ø£Ó£Ô¤Ï£Ö£È£Ä£Ì£¹£³¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤ª¤ê¸ÂÄêŪ¤Ç¤Ï¤¢¤ë¤¬¡¢¶¦Í­ÊÑ¿ô¤ò»ÈÍѤǤ­¤ë¤ß¤¿¤¤¤Ê¤Î¤Ç£Ö£È£Ä£Ì£¹£³¤È£Ö£È£Ä£Ì£²£°£°£²Î¾Êý¤Î»È¤¤Êý¤ò¾Ò²ð¤¹¤ë¡£
¡Ê¤¿¤À¤·º£²ó¡¢¾Ò²ð¤¹¤ëÎã¤Ï£Ø£Ó£Ô¤Ç¹çÀ®½ÐÍè¤Ê¤¤¡£¹çÀ®¤¹¤ë¤¿¤á¤Ë¤ÏƱ¤¸¥¢¡¼¥­¥Æ¥¯¥Á¥ãÆ⤫¤é¶¦Í­ÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤¹¤ëɬÍפ¬¤¢¤ë¡£¡Ë

¤Þ¤º¡¢£Ö£È£Ä£Ì£¹£³¤ÎÎã


package shared_pkg is
    shared variable SH_INT      : integer;
end shared_pkg;

 

library IEEE;
use IEEE.std_logic_1164.all;

library work;
use work.shared_pkg.all;

entity a is
    port
    (
        CLK             : in    std_logic;
        DATA           : out   integer
    );
end a;

architecture a of a is
    component b
        port
        (
            CLK             : in    std_logic
        );
    end component;
begin
    u_b : b port map( CLK );
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            DATA <= SH_INT;
        end if;
    end process;
end a;

 

library IEEE;
use IEEE.std_logic_1164.all;

library work;
use work.shared_pkg.all;

entity b is
    port
    (
        CLK             : in    std_logic
    );
end b;

architecture b of b is
begin
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            SH_INT := SH_INT + 1;
        end if;
    end process;
end b;


¤³¤ÎÎã¤Ç¤Ï¡¢£²¤Ä¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤«¤é¥Ñ¥Ã¥±¡¼¥¸¤ÇÀë¸À¤·¤¿¶¦Í­ÊÑ¿ô¤Ë¥¢¥¯¥»¥¹¤·¤Æ¤¤¤ë¡£

¼¡¤Ë¡¢£Ö£È£Ä£Ì£²£°£°£²¤ÎÎã
package shared_pkg is     -- ¥×¥í¥Æ¥¯¥È¥Ç¡¼¥¿¥¿¥¤¥×
    type SH_TEST is protected
        -- ½ñ¤­¹þ¤ß´Ø¿ô
        procedure write ( data : in integer );
        -- Æɤ߽Ф·´Ø¿ô
        impure function read return integer;
    end protected SH_TEST;

    -- ¶¦Í­ÊÑ¿ô¤ò¥×¥í¥Æ¥¯¥È¥¿¥¤¥×¤ÇÀë¸À
    shared variable SH_INT      : SH_TEST;

end shared_pkg;

package body shared_pkg is

    type SH_TEST is protected body
        -- ¼Â¥Ç¡¼¥¿
        variable buf : integer := 0;
        -- ½ñ¤­¹þ¤ß´Ø¿ô
        procedure write ( data : in integer ) is
        begin
            buf := data;
        end;
        -- Æɤ߽Ф·´Ø¿ô
        impure function read return integer is
        begin
            return buf;
        end;
    end protected body SH_TEST;

end shared_pkg;

 

library IEEE;
use IEEE.std_logic_1164.all;

library work;
use work.shared_pkg.all;

entity a is
    port
    (
        CLK             : in    std_logic;
        DATA            : out   integer
    );
end a;

architecture a of a is
    component b
        port
        (
            CLK             : in    std_logic
        );
    end component;
begin
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            DATA <= SH_INT.read;
        end if;
    end process;
    u_b : b port map( CLK );
end a;

 

library IEEE;
use IEEE.std_logic_1164.all;

library work;
use work.shared_pkg.all;

entity b is
    port
    (
        CLK             : in    std_logic
    );
end b;

architecture b of b is
begin
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            SH_INT.write( SH_INT.read + 1 );
        end if;
    end process;
end b;


£Ö£È£Ä£Ì£²£°£°£²¤Ç¤Ïñ½ã¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤Î¤Ç¤Ï̵¤¯¡¢¥×¥í¥Æ¥¯¥È¥¿¥¤¥×¤òÀë¸À¤·¥Ç¡¼¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î´Ø¿ô¤òÄêµÁ¤·¤Æ¤½¤Î´Ø¿ô¤òÄ̤·¤Æ¥Ç¡¼¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¡£
ÃúÅÙ¡¢£Ã¡Ü¡Ü¤Î¥¯¥é¥¹¤Ç¥×¥é¥¤¥Ù¡¼¥È¤Î¥Ç¡¼¥¿¤Ë¥Ñ¥Ö¥ê¥Ã¥¯¤Î¥á¥½¥Ã¥É¤«¤é¥¢¥¯¥»¥¹¤¹¤ë¤è¤¦¤Ê¥¤¥á¡¼¥¸¤À¡£

º£²ó¡¢¶¦Í­ÊÑ¿ô¤Î»ÈÍÑÎã¤ò¾Ò²ð¤·¤¿¤¬£Ø£Ó£Ô¤Ç¤ÏƱ¤¸¥¢¡¼¥­¥Æ¥¯¥Á¥ãÆ⤫¤é¤Ç¤·¤«¥¢¥¯¥»¥¹½ÐÍè¤Ê¤¤Åù¤ÎÀ©¸Â¤¬¤¢¤ê;¤êÍøÍѲÁÃͤ¬¤Ê¤¤¡£
¤â¤·Ê̤Υ¢¡¼¥­¥Æ¥¯¥Á¥ã¤«¤é¥¢¥¯¥»¥¹½ÐÍè¤ì¤Ð¥Ç¥Ð¥Ã¥°»þ¤Ë¿®¹æ¤ò°ú¤­½Ð¤¹¼êÃʤȤ·¤ÆÍ­¸úÍøÍѤǤ­¤¿¤È»×¤¦¡£»ä¤Ï¥³¥ì¤¬¤ä¤ê¤¿¤«¤Ã¤¿¤Î¤Ç¤È¤Æ¤â»ÄÇ°¤Ë»×¤¦¡£

¾°¡¢º£²ó¤ÎÎã¤ÏÊÑ¿ô¤Î»È¤¤Êý¤È¤·¤Æ¤ÏÎɤ¯¤Ê¤¤Îã¤Ç¡¢Æ±¤¸»þ´Ö¤Ë°ã¤¦¥×¥í¥»¥¹¤«¤é¥ê¡¼¥É¥é¥¤¥È¤·¤Æ¤¤¤ë¤Î¤Ç¥·¥ß¥å¥ì¡¼¥¿¤Ë¤è¤Ã¤Æ¤Ï¥¿¥¤¥ß¥ó¥°¤¬ÊѤï¤ë¤«¤â¤·¤ì¤Ê¤¤¡£¤¢¤¯¤Þ¤Ç¤â¶¦Í­ÊÑ¿ô¤ÎÆ°ºî¤ò³Îǧ¤¹¤ëÌÜŪ¤ÇºîÀ®¤·¤Æ¤¤¤ë¡£

2010/2/19:º£¹¹¤Ê¤¬¤é¾¯¤·½¤Àµ¡¢£Ö£È£Ä£Ì£¹£³ÈǤÎ"DATA <= SH_INT;"¤Ç¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤Ê¤¤¤Î¤ÇCLK¥¤¥Ù¥ó¥È¤Ë¤·¤Þ¤·¤¿¡£


Åê¹Æ»þ¹ï(20:52)¨¢¥³¥á¥ó¥È(4)¨¢VHDL 

2007ǯ09·î10Æü

ÇÛÃÖ¤ÈÇÛÀþ¤Î»ØÄê

£Ø£é£ì£é£î£ø¤Î£Æ£Ð£Ç£Á¤ÇÇÛÃÖ¤ÈÇÛÀþ¤ò»ØÄꤷºÆ¥¤¥ó¥×¥ê¥á¥ó¥È¤·¤Æ¤â¤½¤ì¤ò¸ÇÄꤹ¤ëÊýË¡¤ò¾Ò²ð¤¹¤ë¡£

Á´ÂΤÎή¤ì¤Ï¡¢
¡¦ÇÛÃÖÇÛÀþ¤ò»ØÄꤷ¤¿¤¤²óÏ©¤òŬÅö¤Ë¥¤¥ó¥×¥ê¤¹¤ë
¡¦£Æ£Ð£Ç£Á¥¨¥Ç¥£¥¿¤ÇÇÛÃÖÇÛÀþ¤òÊÔ½¸¤¹¤ë
¡¦ÇÛÃÖÇÛÀþ¤Î»ØÄê¤ò¹Ô¤¦£Õ£Ã£Æ¥Õ¥¡¥¤¥ë¤ò½ÐÎϤ¹¤ë
¤³¤Î¤è¤¦¤Ê´¶¤¸¤Ë¤Ê¤ë¡£

²èÁü¤ò¿¥¤ê¸ò¤¼¤Æ²òÀ⤹¤ì¤Ðʬ¤«¤ê¤ä¤¹¤¤¤Î¤À¤¬¡¢ÂçÊѤʤΤǥƥ­¥¹¥È¤Î¤ß¤Ç¤´´ªÊÛ¤ò¡£
¤½¤ì¤Ç¤Ï¡¢¾ÜºÙ¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ò¾Ò²ð¤¹¤ë¡£

¤½¤Î°ì¡ÊÇÛÃÖ¡Ë
­¡ÇÛÃÖÇÛÀþ»ØÄꤷ¤¿¤¤²óÏ©¤òºîÀ®¤·»ÈÍѤ¹¤ë£Æ£Ð£Ç£Á¤Ë¥¤¥ó¥×¥ê¤¹¤ë¡£
­¢£Æ£Ð£Ç£Á¥¨¥Ç¥£¥¿¤Ç¤½¤Î¥Ç¥¶¥¤¥ó¤ò³«¤¯¡£
­£¤³¤³¤Ç¡¢£Õ£Ã£ÆÅù¤ÇÇÛÃÖ¸ÇÄꤷ¤Æ¤¤¤Ê¤±¤ì¤ÐÅöÁ³Å¬Åö¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¡£
­¤ÇÛÃÖ»ØÄꤷ¤¿¤¤£Ð£É£Î¤ª¤è¤Ó£Ó£Ì£É£Ã£Å¤ÇŬÅö¤ËÇÛÃÖ¤µ¤ì¤Æ¤·¤Þ¤Ã¤¿£Ó£É£Ô£Å¤ÈÇÛÃÖ»ØÄêÀè¤Î£Ó£É£Ô£Å¤òÁªÂò¤·¤Æ£Ó£×£Á£Ð¥Ü¥¿¥ó¤ò²¡¤¹¡£
­¥¤³¤ì¤Ç£Ó£É£Ô£Å¤¬Æþ¤ìÂؤï¤ë¤Î¤Ç¡¢¤³¤ì¤ò·«¤êÊÖ¤·ÌÜŪ¤ÎÇÛÃÖ¤ò´°Î»¤¹¤ë¡£

¤½¤ÎÆó¡ÊÇÛÀþ¡Ë
­¡¸½¾õŬÅö¤ËÇÛÀþ¤µ¤ì¤Æ¤¤¤ÆÇÛÀþ»ØÄꤷ¤¿¤¤¥Í¥Ã¥È¤òÁªÂò¤·£Õ£Î£Ò£Ï£Õ£Ô£Å¥Ü¥¿¥ó¤ò²¡¤¹¡£¤³¤ì¤Ç¥é¥Ã¥Ä¥Í¥Ã¥È¤Ë¤Ê¤ë¡£
­¢¥é¥Ã¥Ä¥Í¥Ã¥È¤Î¥É¥é¥¤¥Ð¤«¤é¥ì¥·¡¼¥Ð¤Þ¤ÇÇÛÀþ¤·¤¿¤¤½çÈÖ¤ËÁªÂò¤·¤Æ¹Ô¤­ºÇ¸å¤Ë
£Ò£Ï£Õ£Ô£Å¥Ü¥¿¥ó¤ò²¡¤¹¡£¤³¤ì¤ÇÁªÂò¤·¤¿½çÈÖ¤ËÇÛÀþ¤µ¤ì¤ë¡£
¤³¤³¤ÇÃí°ÕÅÀ¡§
¡¦¥¹¥¤¥Ã¥Á¥Ü¥Ã¥¯¥¹¤ÏÁªÂò¤·¤Æ¤âÇÛÀþ½ÐÍè¤Ê¤¤¤Î¤ÇÇÛÀþ¤Ë»ÈÍѤ¹¤ë¥Í¥Ã¥È¤òľÀÜÁªÂò¤·¤Æ¹Ô¤¯¡£
¡¦¥ì¥·¡¼¥Ð¤¬Ê£¿ô¤¢¤Ã¤Æ¤â½çÈ֤˻ØÄꤹ¤ì¤Ð£Ï£Ë¡¢ÇÛÀþ»ØÄꤷ¤Ê¤¯¤Æ¤âÎɤ¤¥ì¥·¡¼¥Ð¤ÏÁªÂò¤Ë´Þ¤á¤ºÇÛÀþ»ØÄê¤Î¥Í¥Ã¥È¤òÇÛÀþ¤·¤Æ¤«¤é¥É¥é¥¤¥Ð¡¢¥ì¥·¡¼¥Ð¤òÁªÂò¤·¤Æ£Á£Õ£Ô£Ï£Ò£Ï£Õ£Ô£Å¥Ü¥¿¥ó¤ÇÇÛÀþ¤¹¤ë»ö¤â¤Ç¤­¤ë¡£
¡¦ÇÛÀþ¥ê¥½¡¼¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÁªÂò¤â½ÐÍè¤Ê¤¤¤Î¤Ç¥Ä¡¼¥ë¥Ð¡¼¤Î¥ì¥¤¥ä¡¼¤ÇÇÛÀþ¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤·¤Æ¤ª¤¯¡£
­£¤³¤ì¤ÇÇÛÀþ¤¬½ÐÍè¤ë¤Î¤Ç¡¢¤³¤ì¤ò·«¤êÊÖ¤·ÌÜŪ¤ÎÇÛÀþ¤ò´°Î»¤¹¤ë¡£

¤½¤Î»°¡ÊÀ©ÌóÀ¸À®¡Ë
­¡¥á¥Ë¥å¡¼¤ÎTools¢ªDirected Routing Constraints¤òÁªÂò¤·¤Æ¥À¥¤¥¢¥í¥°¤ò½Ð¤¹¡£
­¢¥À¥¤¥¢¥í¥°¤Î¥ê¥¹¥È¤«¤éÇÛÃÖÇÛÀþ»ØÄê¤ò¹Ô¤¤¤¿¤¤¥Í¥Ã¥È¤òÁª¤Ö¡£
­£½ÐÎϤ¹¤ëUCF File¤ò»ØÄꤹ¤ë¡£
­¤Placement Constraint Type¤ÇUse Absolute Location Constraint¤òÁªÂò¤¹¤ë¡£
­¥Apply¤ò²¡¤¹¡£
­¦¤³¤ì¤Ç¡¢ÇÛÃÖÇÛÀþ¤ò¸ÇÄꤹ¤ë£Õ£Ã£Æ¤¬À¸À®¤µ¤ì¤¿¤Î¤ÇºÆ¥¤¥ó¥×¥ê¤¹¤ì¤Ð£Æ£Ð£Ç£Á¥¨¥Ç¥£¥¿¤ÇÊÔ½¸¤·¤¿²óÏ©¤¬ºÆ¸½½ÐÍè¤ë¡£

¤³¤ì¤Ïñ½ã¤ÊÎã¤À¤¬¡¢¤³¤ì¤Î±þÍѤǿ§¡¹½ÐÍè¤ë¤È»×¤¦¡£

2007/09/11 - Directed RoutingÀ©Ìó¤Ë¤ÏÂбþ¥Ç¥Ð¥¤¥¹¤ËÀ©¸Â¤¬¤¢¤ë¡£
»ÈÍÑÉÔ²Ä:Virtex/VirtexE/Virtex2ProX/Spartan2/SpartanE/PLD
»ÈÍѲÄǽ:Virtex2/Virtex2Pro/Virtex4/Virtex5/Spartan3



Åê¹Æ»þ¹ï(21:43)¨¢¥³¥á¥ó¥È(0)¨¢Xilinx¥Ä¡¼¥ë 

2007ǯ09·î04Æü

£Ö£È£Ä£Ì¤Ç£Æ£Ð£Ç£Á¤Î¥Ð¡¼¥¸¥ç¥ó´ÉÍý

³§¤µ¤ó¤Ï£Æ£Ð£Ç£Á¤Î¥Ð¡¼¥¸¥ç¥ó´ÉÍý¤Ï¤É¤¦¤·¤Æ¤¤¤Þ¤¹¤«¡©
¡Ö¤¿¤Þ¤Ë¥¨¥é¡¼½Ð¤ë¤±¤É¤³¤ì¤¤¤Ä¤Î¥Ð¡¼¥¸¥ç¥ó¤«Ê¬¤«¤é¤Ê¤¤¡ª¡×
¡Ö¥Ð¡¼¥¸¥ç¥ó¥ì¥¸¥¹¥¿¤òÉÕ¤±¤¿¤±¤É¹¹¿·¤¹¤ë¤Î˺¤ì¤¿¡ª¡×
¤Ê¤ó¤Æ»ö¤¢¤ê¤Þ¤»¤ó¤«¡©
»ä¤Ï¤è¤¯¤¢¤ê¤Þ¤¹¡¥¡¥¡¥

¤½¤³¤Ç¡ªÏÀÍý¹çÀ®¤¹¤ë¤¿¤Ó¤Ë¼«Æ°Åª¤Ë¥¤¥ó¥¯¥ê¥á¥ó¥È¤·¤Æ¤¯¤ì¤ë¿®¹æ¤òºî¤Ã¤Æ¤ß¤Þ¤·¤¿¡£¤³¤ì¤Ï¹çÀ®»þ¤ËÃͤ¬·èÄꤹ¤ë¤Î¤Ç²óÏ©¤Î¥ê¥½¡¼¥¹¤Ï¾ÃÈñ¤·¤Þ¤»¤ó¤·¡¢¼«Æ°¤Ê¤Î¤Ç¹¹¿·¤ò˺¤ì¤ë¤³¤È¤â¤¢¤ê¤Þ¤»¤ó¡£

»È¤¤Êý¤Ï¡¢£Æ£Ð£Ç£Á¤Î¥È¥Ã¥×¤«¤éËܥѥ屡¼¥¸¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¤À¤±¤Ç¤¹¡£
°Ê²¼¤Ë»ÈÍÑÎã¤ò¾Ò²ð¤·¤Þ¤¹¡£


-- ¥Ð¡¼¥¸¥ç¥ó¼èÆÀ¥Ñ¥Ã¥±¡¼¥¸¤Î»²¹ÍÎã
library IEEE;
use IEEE.std_logic_1164.all;

-- £Æ£Ð£Ç£Á¤Î¥È¥Ã¥×¥Õ¥¡¥¤¥ë¤Ë¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤òÀë¸À¤¹¤ë¡£
library work;
use work.ver_get.all;

entity top is
    generic
    (
        -- ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤ò¹Ô¤¦¾ì¹ç¤Ï¡¢
        -- ¥Æ¥¹¥È¥Ù¥ó¥Á¤«¤é¡ÖSIM_MODE¡×¤ò1¤Ë¤·¤Æ¸Æ¤Ó½Ð¤¹¡£
        -- ¹çÀ®¤Î»þ¤Ï¥Ç¥£¥Õ¥©¥ë¥È¤Î0¤¬¼«Æ°Åª¤Ë³ä¤êÅö¤¿¤ë¡£
        SIM_MODE            : integer := 0
    );
    port
    (
        VER_OUT         : out   std_logic_vector(31 downto 0)
    );
end top;

architecture top of top is

    -- ¤³¤Î¸Æ¤Ó½Ð¤·¤ÇÏÀÍý¹çÀ®¤¹¤ëËè¤Ë¥¤¥ó¥¯¥ê¥á¥ó¥È¤µ¤ì¤¿ÃͤòÊÖ¤¹¡£
    constant    VERSION : std_logic_vector(31 downto 0)
                                := get_version( SIM_MODE, "ver.txt" );

begin

    VER_OUT <= VERSION;

end top;


Æ°ºî¤Î»ÅÁȤߤϡ¢ÏÀÍý¹çÀ®»þ¤Ë»ØÄꤵ¤ì¤¿¥Ð¡¼¥¸¥ç¥ó¥Õ¥¡¥¤¥ë¤«¤é¥Ð¡¼¥¸¥ç¥ó¥Ç¡¼¥¿¤òÆɤ߽Ф·¥¤¥ó¥¯¥ê¥á¥ó¥È¤·¤¿¥Ð¡¼¥¸¥ç¥ó¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à¤À¤±¤Ç¤¹¡£
¾Ü¤·¤¯¤Ï¥Ñ¥Ã¥±¡¼¥¸¥Õ¥¡¥¤¥ë¤Ë¥³¥á¥ó¥È¤ò½ñ¤¤¤Æ¤¤¤Þ¤¹¤Î¤Ç¤½¤ì¤ò¸«¤Æ¤¯¤À¤µ¤¤¡£

¥Ñ¥Ã¥±¡¼¥¸¤Ï¥³¥³¡¢
»²¹Í¥Õ¥¡¥¤¥ë¤Ï¥³¥³¡¢
¥Ð¡¼¥¸¥ç¥ó¥Õ¥¡¥¤¥ë¤Î»²¹ÍÎã¤Ï¥³¥³
¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£

¡Ö¤â¤Ã¤ÈÎɤ¤ÊýË¡¤·¤Ã¤Æ¤ë¤è¡ª¡×¤Ã¤Æ¿Í¤ÏÀ§È󶵤¨¤Æ¤¯¤À¤µ¤¤¡£

Åê¹Æ»þ¹ï(20:14)¨¢¥³¥á¥ó¥È(6)¨¢VHDL 

2007ǯ08·î31Æü

½ñɾ¡Ö£Ö£È£Ä£Ì¡×

delta_out.gif

¥¿¥¤¥È¥ë¡Ö£Ö£È£Ä£Ì¡×
Ãø¼Ô¡Ö£Ä£ï£õ£ç£ì£á£ó¡¡£Ì¡¥ £Ð£å£ò£ò£ù¡×
½ÐÈǼҡ֥¢¥¹¥­¡¼½ÐÈǶɡ×
ȯ¹ÔÆü¡Ö£±£¹£¹£¶Ç¯£±£±·î£±Æü¡×
£É£Ó£Â£Î¡Ö£´¡Ý£·£µ£¶£±¡Ý£±£¹£°£¶¡Ý£¹¡×




¤³¤ì¤Ï¡¢»ä¤¬½é¤á¤Æ¹ØÆþ¤·¤¿£Ö£È£Ä£Ì¤ÎËܤÀ¡£
Åö»þ£Ö£È£Ä£Ì¤ÎËܤÏÁªÂò»è¤¬¾¯¤Ê¤¯¤³¤ÎËܤ¬°ìÈÖ¤Ö¸ü¤¯ÆâÍƤ¬Ç»¤¤¤È»×¤Ã¤¿¤Î¤ÇÁª¤ó¤À¡£¤È¤³¤í¤¬¡¢ºÇ½é¤«¤éÆɤ߿ʤá¤Æ¤âÁ´¤¯Íý²ò½ÐÍè¤Ê¤¤¡ª»ÅÊý¤¬¤Ê¤¤¤Î¤Ç½é¿´¼Ô¸þ¤±¤ÎÆþÌç½ñ¤òÊ̤˹ØÆþ¤·¤ÆÊÙ¶¯¤·¤¿¡£¤½¤·¤Æ¿ô·ï¤Î³«È¯¤ò·Ð¸³¤·£Ö£È£Ä£Ì¤ÎÍý²ò¤¬¿¼¤Þ¤Ã¤¿¤È¤³¤í¤Ç¤â¤¦°ìÅÙ¤³¤ÎËܤòÆɤà¤È¡Ö¿¿¤Î£Ö£È£Ä£Ì¤Î»Ñ¡×¤ò»×¤¤ÃΤ餵¤ì¤¿¡£¤½¤ì¤«¤é¤³¤ÎËܤϰì»þ¤â¼êÊü¤»¤Ê¤¤¥ê¥Õ¥¡¥ì¥ó¥¹ËܤȤʤ꺣¤Ç¤â»²¾È¤µ¤»¤Æ¤â¤é¤Ã¤Æ¤¤¤ë¡£
¤Þ¤¿¡¢±Ñ¸ì¤¬ÆÀ°Õ¤Ç¤Ê¤¤¿Í¤Ë¤È¤Ã¤Æ¤Ï¡¢±Ñ¸ì¤Î£Ì£Ò£Í¤òÆɤàÁ°¤Ë¤³¤ì¤òÆɤà¤È¸À¤Ã¤¿»È¤¤Êý¤â½ÐÍè¤ë¤È»×¤¦¡£

¤Þ¤È¤á¤ë¤È¡¢¤³¤ÎËܤϽ鿴¼Ô¸þ¤±¤Ç¤Ï¤Ê¤¤¤¬¡¢¾åµé¼Ô¤òÌܻؤ¹Ãæµé¼Ô¤Ë¤È¤Ã¤Æ¤Ï¤È¤Æ¤âÎɤ¤ËܤÀ¤È»×¤¦¡£À§Èó¹ØÆþ¤ò¿Ê¤á¤¿¤¤¡ª¡¥¡¥¡¥¤¬ÀäÈǤȤʤäƤ¤¤¿¤È»×¤¦¡££Á£í£á£ú£ï£î¤Ë¤Ï¿ôÅÀºß¸Ë¤¬¤¢¤Ã¤¿¤Î¤Ç¤³¤ì¤¬ºÇ¸å¤Î¥Á¥ã¥ó¥¹¤«¤â¤·¤ì¤Ê¤¤¡£

¤ª¤¹¤¹¤áÅÙ¡§¡ú¡ú¡ú¡ú¡ú



Åê¹Æ»þ¹ï(19:01)¨¢¥³¥á¥ó¥È(4)¨¢½ñɾ 

2007ǯ08·î29Æü

VHDL TIPS ¡Öpostponed process¤Î»ÈÍÑË¡¡×

Á°²ó¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¡¦¥µ¥¤¥¯¥ë¤Ç¾¯¤·¿¨¤ì¤¿¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤ò¾Ò²ð¤¹¤ë¡£

¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ï£Ö£È£Ä£Ì£¹£³¤ÇÄɲ䵤줿µ¡Ç½¤Ç¡¢¤½¤Î»þ¹ï¤ÎÁ´¤Æ¤Î¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤¬½ª¤ï¤Ã¤¿¸å¤Ç¼Â¹Ô¤µ¤ì¤ë¥×¥í¥»¥¹¤Ç¤¢¤ë¡£

Æ°ºî¤ò¥µ¥ó¥×¥ë¥½¡¼¥¹¤Ç¸«¤Æ¤ß¤ë»ö¤Ë¤¹¤ë¡£
°Ê²¼¤Î¥½¡¼¥¹¤Ï£´¥Ó¥Ã¥È¤ÎƱ´ü¥«¥¦¥ó¥¿¤òÄ̾ï¤Î¥×¥í¥»¥¹¤È¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ç¥»¥Ã¥È¥¢¥Ã¥×¥Á¥§¥Ã¥¯¤ò¹Ô¤¤Æ°ºî¤òÈæ³Ó¤·¤¿Îã¤À¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity PP_TEST is
end PP_TEST;

architecture behavior  of PP_TEST is

    signal  CLK     : std_logic;
    signal  COUNT   : std_logic_vector(3 downto 0) := (others => '0');

begin

    -- ¥¯¥í¥Ã¥¯À¸À®
    process begin
        CLK <= '0';
        wait for 10 ns;
        CLK <= '1';
        wait for 10 ns;
    end process;

    -- CLK¤ÇCOUNT¤ò¥¤¥ó¥¯¥ê¥á¥ó¥È
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            COUNT <= COUNT + '1';
        end if;
    end process;

    -- COUNT¤Î¥»¥Ã¥È¥¢¥Ã¥×¥Á¥§¥Ã¥¯
    process ( CLK ) begin
        if ( CLK = '1' ) then
            assert ( COUNT'last_event >= 5 ns )
                report "Setup Time was not suitable."
                severity WARNING;
        end if;
    end process;

    -- COUNT¤Î¥»¥Ã¥È¥¢¥Ã¥×¥Á¥§¥Ã¥¯
    postponed process ( CLK ) begin
        if ( CLK = '1' ) then
            assert ( COUNT'last_event >= 5 ns )
                report "Setup Time was not suitable.(postponed)"
                severity WARNING;
        end if;
    end process;

end behavior;


¤³¤ì¤ò¼Â¹Ô¤¹¤ë¤È¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Î¥¢¥µ¡¼¥·¥ç¥ó¤À¤±¥¢¥¯¥Æ¥£¥Ö¤Ë¤Ê¤ë¡£
¤³¤ì¤Ï¡¢Àè¤Û¤É¤â½ñ¤¤¤¿¤¬Á´¤Æ¤Î¥Ç¥ë¥¿Ãٱ䤬½èÍý¤µ¤ì¤¿¸å¤Ç¥«¥¦¥ó¥¿¤Î¥»¥Ã¥È¥¢¥Ã¥×¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¤¿¤á¥»¥Ã¥È¥¢¥Ã¥×»þ´Ö¤¬£°¤È¤Ê¤ê£µ£î£ó°Ê¾å¤Ç¤Ï̵¤¤¤Î¤Ç¥¢¥µ¡¼¥È¤¹¤ë¡£
°ìÊý¡¢Ä̾ï¤Î¥×¥í¥»¥¹¤Ï¥«¥¦¥ó¥¿¤ÎÃͤ¬¹¹¿·¤µ¤ì¤ë£±¤ÄÁ°¤Î¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤Ç¥»¥Ã¥È¥¢¥Ã¥×¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¤¿¤á¥»¥Ã¥È¥¢¥Ã¥×»þ´Ö¤¬£±£°£î£ó¤È¤Ê¤ê£µ£î£ó°Ê¾å¤Ê¤Î¤Ç¥¢¥µ¡¼¥È¤µ¤ì¤Ê¤¤¡£

¤³¤³¤ÇÃí°Õ¤È¤·¤Æ¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ç¥¯¥í¥Ã¥¯¥¤¥Ù¥ó¥ÈÅù¤òɾ²Á¤·¤¿¾ì¹ç¡¢¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤¬Ìµ¤¤¾ì¹ç¤ò½ü¤­¿¿¤¬Ê֤äƤ¯¤ë¤³¤È¤Ï¤Ê¤¤¡£
¤Þ¤¿¡¢¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ç¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤òȯÀ¸¤µ¤»¤ë»ö¤Ï¶Ø»ß¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
´Êñ¤Ë¸À¤¦¤È¡¢¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ç¡Öif ( CLK'event and CLK = '1' )¡×¤È½ñ¤¤¤Æ¤â´û¤Ë¥¯¥í¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï½ªÎ»¤·¤Æ¤¤¤ë¤Î¤Ç¤³¤Î£É£Æʸ¤Ï¼Â¹Ô¤µ¤ì¤ë»ö¤Ï̵¤¤¡£¤È¸À¤¦»ö¤È¡¢¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ç¡ÖA <= B;¡×Åù¤È¿®¹æ¤ÎÂåÆþ¤ò¹Ô¤Ã¤Æ¤Ï¥À¥á¤È¸À¤¦»ö¤Ç¤¢¤ë¡£

Åê¹Æ»þ¹ï(12:55)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ08·î28Æü

¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¡¦¥µ¥¤¥¯¥ë

£Ö£È£Ä£Ì¤Ë¤ª¤±¤ë¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¡¦¥µ¥¤¥¯¥ë¤ò°Ê²¼¤Ë¾Ò²ð¤¹¤ë¡£


£±¡¥Tc¤ËTn¤òÂåÆþ
¤³¤³¤Ç¡¢¥¢¥¯¥Æ¥£¥Ö¤Ê¥É¥é¥¤¥Ð¤ä³«»Ï¤¹¤ë¥×¥í¥»¥¹¤¬¤Ê¤¤¡¢¤Þ¤¿¤Ï
¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤ÎºÇÂç»þ¹ï¤Ê¤é¤Ð¥·¥ß¥å¥ì¡¼¥·¥ç¥ó½ªÎ»

£²¡¥¿®¹æ¤ò¹¹¿·¤¹¤ë¡£

£³¡¥¹¹¿·¤µ¤ì¤¿¿®¹æ¤Ë¥»¥ó¥·¥Æ¥£¥Ö¤ÊÁ´¤Æ¤Î¥×¥í¥»¥¹¤ò¼Â¹Ô¤¹¤ë

£´¡¥°Ê²¼¤ÎÃæ¤ÇºÇ¤â¶á¤¤»þ¹ï¤òTn¤ËÆþ¤ì¤ë
¡¦¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤ÎºÇÂç»þ¹ï
¡¦¥É¥é¥¤¥Ð¤¬¥¢¥¯¥Æ¥£¥Ö¤Ë¤Ê¤ë¼¡¤Î»þ¹ï
¡¦¥×¥í¥»¥¹¤¬ºÆ³«¤¹¤ë¼¡¤Î»þ¹ï
¤³¤Î½èÍý¸å¡¢Tc¤ÈTn¤¬Æ±¤¸¤Ê¤é¤Ð¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤Ê¤Î¤Ç
¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤ò¿Ê¤á¤Æ£±¤ËÌá¤ë

£µ¡¥¼Â¸úÃÙ±ä¥×¥í¥»¥¹¤ò¼Â¹Ô¤·¤Æ£±¤ËÌá¤ë

Tc¡§¸½ºß¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥µ¥¤¥¯¥ë¤Î»þ¹ï
Tn¡§¼¡¤Î¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥µ¥¤¥¯¥ë¤Î»þ¹ï


£Ö£È£Ä£Ì¥·¥ß¥å¥ì¡¼¥¿¤Ï¤³¤Î½èÍý¤ò·«¤êÊÖ¤·¹Ô¤¤¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤ò¿Ê¤á¤Æ¤¤¤ë¡£
¤³¤ì¤òÍý²ò½ÐÍè¤ë¤È¥Ç¥ë¥¿ÃÙ±ä¤ä¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹Åù¤ÎÍý²ò¤âÁᤤ¤È»×¤¦¤Î¤ÇÀ§ÈóÍý²ò¤·¤¿¤¤½ê¤À¡£
¼Â¹ÔÃÙ±ä¥×¥í¥»¥¹¤Ë¤Ä¤¤¤Æ¤Ï¼¡¤Îµ¡²ñ¤Ë½ñ¤³¤¦¤È»×¤¦¡£



Åê¹Æ»þ¹ï(21:48)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ08·î27Æü

¥»¥ì¥¯¥¿¤ò£²¸Äʤ٤ƣġݣƣÆ

´ðËÜŪ¤ÊÆâÍƤò¤Ò¤È¤Ä

¥»¥ì¥¯¥¿¤ò£²¸Äʤ٤ƣġݣƣƤòºî¤ë
¡¦£²ÆþÎÏ£±½ÐÎϤΥ»¥ì¥¯¥¿¤ò£²ÃÊʤ٤ë
¡¦ºÇ½é¤Î¥»¥ì¥¯¥¿¤Î½ÐÎϤòºÇ¸å¤Î¥»¥ì¥¯¥¿¤ÎÆþÎÏ£°¤ËÀܳ
¡¦¤½¤ì¤¾¤ì¤Î¥»¥ì¥¯¥¿½ÐÎϤò¼«Ê¬¤ÎÆþÎÏ£±¤ËÀܳ
¡¦£Ã£Ì£ËÆþÎϤòºÇ½é¤Î¥»¥ì¥¯¥¿¤Î¥»¥ì¥¯¥È¤ËÆþÎÏ
¡¦£Ã£Ì£ËÆþÎϤòºÇ¸å¤Î¥»¥ì¥¯¥¿¤Î¥»¥ì¥¯¥È¤ËȿžÆþÎÏ
¡¦ºÇ½é¤Î¥»¥ì¥¯¥¿¤ÎÆþÎÏ£°¤Ï£ÄÆþÎÏ
¡¦ºÇ¸å¤Î¥»¥ì¥¯¥¿¤Î½ÐÎϤϣѽÐÎÏ

½ÐÍè¾å¤¬¤ê¡ª



Åê¹Æ»þ¹ï(21:15)¨¢¥³¥á¥ó¥È(0)¨¢»¨µ­ 

2007ǯ08·î23Æü

£È£å£ì£ì£ï¡¢¡¡£÷£ï£ò£ì£ä¡ª

¤³¤³¿ôÆü¡¢³°½Ð¤Ê¤É¤ÇË»¤·¤«¤Ã¤¿¤¿¤á£Â£ì£ï£ç¤¬¹¹¿·½ÐÍè¤Ê¤«¤Ã¤¿¡£
Ê¿Æü£±·ï¤Î¥Ú¡¼¥¹¤ò°Ý»ý¤·¤¿¤¤¤¬¡¢¤«¤Ê¤êÂçÊѤʻö¤À¤È´¶¤¸¤¿¡££Æ£Ð£Ç£Á¤ÎÉô²°¤µ¤ó¤Ï¡¢¤³¤ì¤ò¿ôǯ³¤±¤Æ¤¤¤ë¤Î¤À¤«¤éËÜÅö¤Ëº·É¤¹¤ë¡£

¤Ê¤Ä¤¿¤ó¤µ¤ó¤Î½ê¤Ç£Ö£È£Ä£Ì¤Î£Ó£è£ï£ò£ô£Ã£ï£ä£é£î£ç¤Î¥é¥ó¥­¥ó¥°¥µ¥¤¥È¤¬¾Ò²ð¤µ¤ì¤Æ¤¤¤¿¡£
Áᮣ֣ȣģ̤ǣȣå£ì£ì£ï£×£ï£ò£ì£ä¤Ë»²²Ã¡ª¤³¤Î¤ª¤â¤·¤í¤µ¤Ë¤Ï¤Þ¤Ã¤Æ¤·¤Þ¤Ã¤¿¡££±»þ´Ö¤Û¤É¹Í¤¨¤¿¤¬¡¢¤³¤ì°Ê¾å¾®¤µ¤¯¤¹¤ë¤Î¤Ï̵Íý¤Ê¤Î¤«¤Ê¡©¤Ã¤Æ»ö¤Ç£å£ã£è£ï¤Ë¤â»²²Ã¡ª¤³¤ì°Ê¹ß¤ÎÌäÂê¤ÏÈè¤ì¤¿¤Î¤Ç½ªÎ»¡ª
¤ä¤Ã¤Ñ¤ê¥·¥ó¥×¥ë¤ÊÌäÂ꤬¤ª¤â¤·¤í¤¤¡£



Åê¹Æ»þ¹ï(12:51)¨¢¥³¥á¥ó¥È(2)¨¢VHDL 

2007ǯ08·î16Æü

VHDL TIPS ¡Örange¤Ç¥Ñ¥é¥á¡¼¥¿À©Ìó¡×

¥â¥¸¥å¡¼¥ë¤Î¥Ñ¥é¥á¡¼¥¿¥Á¥§¥Ã¥¯¤Ï¡Öassert¡×¤ò»ÈÍѤ¹¤ë»ö¤¬Â¿¤¤¤¬¡¢Ã±½ã¤ÊÈÏ°ÏÀ©Ìó¤Ç¤¢¤ì¤Ð¡Örange¡×¤ò»ÈÍѤ¹¤ë»ö¤â½ÐÍè¤ë¡£
¡Örange¡×¤ò»ÈÍѤ¹¤ë¤ÈÀÅŪ¥Ñ¥é¥á¡¼¥¿¤Ç¤¢¤ì¤Ð¥³¥ó¥Ñ¥¤¥ë»þ¤Ë¥Á¥§¥Ã¥¯¤·¡¢Æ°Åª¥Ñ¥é¥á¡¼¥¿¤Ç¤¢¤ì¤ÐÈϰϳ°¤Ë¤Ê¤Ã¤¿½Ö´Ö£Æ£á£ô£á£ì¤Ë¤Ê¤ë¡£¡Ê£Í£ï£ä£å£ì£Ó£é£í¡Ë

°Ê²¼¤Ë¥µ¥ó¥×¥ë¥½¡¼¥¹¤ò¾Ò²ð¤¹¤ë¡£
¤³¤Î¥µ¥ó¥×¥ë¤Ï¡Öinteger¡×¥Ç¡¼¥¿¥¿¥¤¥×¤Î¥·¥Õ¥È¥ì¥¸¥¹¥¿¤Ç¥·¥Õ¥È¿ô¤ÈºÇÂç¥Ç¡¼¥¿Ãͤò»ØÄꤹ¤ë»ö¤¬½ÐÍè¤ë¡£
¤¿¤À¤·¡¢ÈÏ°ÏÀ©Ìó¤È¤·¤Æ¡¢¥·¥Õ¥ÈÃͤϣ±¡Á£±£°¡Ê¥Ç¥£¥Õ¥©¥ë¥È£µ¡Ë¡¢Æþ½ÐÎϥǡ¼¥¿¤Ï»ØÄꤵ¤ì¤¿ºÇÂç¥Ç¡¼¥¿Ã͡ʥǥ£¥Õ¥©¥ë¥È£±£²£¸¡Ë¤òÆþ¤ì¤Æ¤¤¤ë¡£


library IEEE;
use IEEE.std_logic_1164.all;

-- integer¥Ç¡¼¥¿¥¿¥¤¥×¤ÎÃÙ±ä¥â¥¸¥å¡¼¥ë
entity INT_DLY is
    generic
    (
        -- Ãٱ䥯¥í¥Ã¥¯¿ô
        COUNT   : in    integer range 1 to 10 := 5;
        -- ¥Ç¡¼¥¿¤ÎºÇÂçÃÍ
        DMAX    : in    integer := 128
    );
    port
    (
        CLK     : in    std_logic;
        DIN     : in    integer range 0 to DMAX;
        DOUT    : out   integer range 0 to DMAX
    );
end INT_DLY;

architecture behavior of INT_DLY is

    -- integer¤ÎÇÛÎóÄêµÁ
    type int_vector is array ( natural range <> ) of integer;

    -- ÃÙ±ä¤ò¥·¥Õ¥È¥ì¥¸¥¹¥¿¤Ç¼Â¸½¤¹¤ë¤¿¤á¤Î¥ì¥¸¥¹¥¿ÇÛÎó
    signal  DELAY   : int_vector(COUNT-1 downto 0);

begin

    -- integer¤Î¥·¥Õ¥È¥ì¥¸¥¹¥¿
    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            DELAY(0) <= DIN;
            for i in 1 to COUNT-1 loop
                DELAY(i) <= DELAY(i-1);
            end loop;
        end if;
    end process;
    DOUT <= DELAY(COUNT-1);

end behavior;


¤³¤Î¥â¥¸¥å¡¼¥ë¤òCOUNT=11¤Ç¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¡¢¥³¥ó¥Ñ¥¤¥ë»þ¤Ë¥¨¥é¡¼¤È¤Ê¤ë¡£
¤Þ¤¿¡¢DMAX=128¤Ç¥³¥ó¥Ñ¥¤¥ë¡¢¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤·DIN¤¬0¡Á128¤òĶ¤¨¤¿½Ö´Ö¤Ë£Æ£á£ô£á£ì¤È¤Ê¤ê¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤¬¥¹¥È¥Ã¥×¤¹¤ë¡£

¤³¤Î¤è¤¦¤Ë¡Örange¡×¤ÇÈÏ°ÏÀ©Ìó¤ò¹Ô¤¦¤È»ÈÍѤ¹¤ë¦¤«¤é¸«¤ÆÀ©Ì󤬲ò¤ê¤ä¤¹¤¯¡¢¥é¥¤¥Ö¥é¥êÅù¤Î¶¦Í­¥â¥¸¥å¡¼¥ë¤Ë¤ÏÆþ¤ì¤Æ¤ª¤­¤¿¤¤¡£



Åê¹Æ»þ¹ï(21:26)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ08·î13Æü

VHDL TIPS ¡Östd_match¤Î»ÈÍÑË¡¡×

Î㤨¤Ð£²¤Ä¤ÎSTD_LOGIC¤òñ½ã¤ËÈæ³Ó¤¹¤ë¤È'1'¤ä'0'¤Î»þ¤Ï²¿¤âµ¿Ìä¤Ê¤¯·ë²Ì¤¬½Ð¤ë¤È»×¤¦¡£¤¿¤ÀSTD_LOGIC¤Ï'U'¤ä'-'¤Ê¤É¤Î¾õÂ֤⸺ߤ¹¤ë¡£
¤³¤ì¤é¤¬´Þ¤Þ¤ì¤¿Èæ³Ó¤ò¹Ô¤Ã¤¿¾ì¹ç¤Ï¤É¤¦¤Ê¤ë¤«¡©
¡¡¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Ç¤Ïñ½ã¤Ë¡á¡Ê¥¤¥³¡¼¥ë¡Ë¤ÇÈæ³Ó¤·¤¿¾ì¹ç¤ÏÀµ³Î¤ËƱ¤¸¾õÂ֤Ǥʤ¤¤È¥¤¥³¡¼¥ë¤È¤Ï¤Ê¤é¤Ê¤¤¡£
¡¡¹çÀ®¥Ä¡¼¥ë¡ÊXST)¤Ç¤Ï'-'¤ä'X'¤Ï¥É¥ó¥È¥±¥¢¤È¤·¤Æ½èÍý¤·ºÇŬ²½¤µ¤ì¤ë¡£
¤³¤Î»ö¤«¤é¡¢¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤È¼Âµ¡¤ÎÆ°ºîÉÔ°ìÃפ¬È¯À¸¤¹¤ë¡£¤³¤ì¤ò²óÈò¤¹¤ë¤¿¤á¤Ë¡Önumeric_std¡×¤Ë´Þ¤Þ¤ì¤ë¡Östd_match¡×¥Õ¥¡¥ó¥¯¥·¥ç¥ó¤¬»ÈÍѤǤ­¤ë¡£
std_match¤Ï'-'¤ò¥É¥ó¥È¥±¥¢¤È¤¹¤ë¤À¤±¤Ç¤Ê¤¯'U'¤Ê¤É¤ÎÉÔÄêÃͤ¬°ìÃפ·¤¿¾ì¹ç¤Ç¤â¥¤¥³¡¼¥ë¤È¤·¤Ê¤¤¤è¤¦¤ÊÆ°ºî¤ò¤·¤Æ¼Âµ¡¤È°ìÃפµ¤»¤Æ¤¤¤ë¡£
¡ÊXST¤Ï'X'¤ò¥É¥ó¥È¥±¥¢¡¢std_match¤ÏÉÔÄêÃͤȤ·¤Æ½èÍý¤¹¤ë¤Î¤ÇÆ°ºî¤¬°ìÃפ·¤Æ¤¤¤Ê¤¤¤¬¡¢numeric_std¤ò»²¹Í¤Ë¥Æ¡¼¥Ö¥ë¤ò¾¯¤·ÊѤ¨¤ë¤À¤±¤Ç´Êñ¤Ë¿·¤¿¤Ê¥Õ¥¡¥ó¥¯¥·¥ç¥ó¤òºîÀ®¤Ç¤­¤ë¡Ë

¤·¤«¤·¡¢¤½¤â¤½¤â'-'¡Ê¥É¥ó¥È¥±¥¢¡Ë¤ÈÈæ³Ó¤¹¤ë»ö¼«ÂΡ¢°ÕÌ£¤¬Ìµ¤¤¤Ê¤ó¤Æ»×¤ï¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£¤½¤ì¤Ï¤½¤ÎÄ̤ê¤Ê¤Î¤À¤¬¡¢¥Ç¡¼¥¿¤¬¥Ù¥¯¥¿¥¿¥¤¥×¤Ë¤Ê¤ë¤È°ÕÌ£¤¬½Ð¤Æ¤¯¤ë¡£Î㤨¤Ð¡¢¤¢¤ë¥Ó¥Ã¥È¤À¤±Èæ³Ó¤·¤Ê¤¯¤ÆÎɤ¤¾ì¹ç¤Ê¤É¤Ï¤½¤ÎÉôʬ¤ò'-'¤ò¥É¥ó¥È¥±¥¢¤È¤·¤ÆÈæ³Ó¤¹¤ì¤Ð°ìÅ٤˵­½Ò¤¹¤ë»ö¤¬½ÐÍè¤ë¡Ê"0-01--10"Åù¡Ë

°Ê²¼¤Ëstd_match¤ÎÆ°ºî¤ò¾Ò²ð¤¹¤ë¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity test is
end test;

architecture behavior of test is

    signal  result_match    : boolean := FALSE;
    signal  result_equ      : boolean := FALSE;
    signal  testdata        : std_logic_vector(2 downto 0) := (others => '0');

begin

    -- ¸ÇÄêÃÍ
    testdata(2) <= '1';
    testdata(0) <= '0';

    -- std_logic¤ÎÁ´¤Æ¤Î¾õÂÖ¤ò·«¤êÊÖ¤¹
    process begin
        testdata(1)  <= 'U';
        wait for 10 ns;
        testdata(1) <= 'X';
        wait for 10 ns;
        testdata(1) <= '0';
        wait for 10 ns;
        testdata(1) <= '1';
        wait for 10 ns;
        testdata(1) <= 'Z';
        wait for 10 ns;
        testdata(1) <= 'W';
        wait for 10 ns;
        testdata(1) <= 'L';
        wait for 10 ns;
        testdata(1) <= 'H';
        wait for 10 ns;
        testdata(1) <= '-';
        wait for 10 ns;
    end process;


    -- ¥¤¥³¡¼¥ë¡Ê=¡Ë¤ÇÈæ³Ó¤·¤¿¾ì¹ç
    process begin
        if ( testdata = "1-0" ) then
            result_equ <= TRUE;
        else
            result_equ <= FALSE;
        end if;
        wait on testdata;
    end process;

    -- std_match¤ò»È¤Ã¤¿¾ì¹ç
    process begin
        if ( std_match(testdata, "1-0")) then
            result_match <= TRUE;
        else
            result_match <= FALSE;
        end if;
        wait on testdata;
    end process;

end behavior;


¤³¤ì¤Î·ë²Ì¤Ï¡¢

delta_out.gif

 

 

¤³¤Î¤è¤¦¤Ë¡¢Ã±½ã¤Ë¡á¡Ê¥¤¥³¡¼¥ë¡Ë¤ÇÈæ³Ó¤·¤¿¾ì¹ç¤Ï´°Á´¤Ë°ìÃפ·¤¿"1-0"¤Î¾ì¹ç¤À¤±£Ô£Ò£Õ£Å¤Ë¤Ê¤ê¡¢std_match¤ò»ÈÍѤ·¤¿¾ì¹ç¤Ïtestdata(2)¤Ètestdata(0)¤À¤±¤ÎÈæ³Ó¤Ë¤Ê¤ë¤Î¤Ç¾ï»þ£Ô£Ò£Õ£Å¤Ë¤Ê¤ë¡£



Åê¹Æ»þ¹ï(20:08)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ08·î09Æü

¥¤¥Ù¥ó¥È¤È¥È¥é¥ó¥¶¥¯¥·¥ç¥ó

£Ö£È£Ä£Ì¤Ë¤Ï¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤È¤¤¤¦±¢¤Î¸ºß¤¬¤¢¤ë¡£
¥¤¥Ù¥ó¥È¤â¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Î°ìÉô¤Ç¡¢¥¤¥Ù¥ó¥È¤òȼ¤¦¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Èȼ¤ï¤Ê¤¤¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤¬¤¢¤ë¤È¹Í¤¨¤ë»ö¤¬½ÐÍè¤ë¡£

¥¤¥Ù¥ó¥È¤ÏÃͤ¬ÊѲ½¤·¤¿¾ì¹ç¤ËȯÀ¸¤¹¤ë¡£¤·¤«¤·¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÏÃͤÎÂåÆþ¤¬¹Ô¤ï¤ì¤ë¤À¤±¤ÇȯÀ¸¤¹¤ë¡£
°Ê²¼¤ÎÎã¤Ç¤Ï¿®¹æ£Á¤ËÂФ·¤Æ¥¤¥Ù¥ó¥È¤ÏȯÀ¸¤·¤Ê¤¤¤¬¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÏȯÀ¸¤¹¤ë¡£
¤·¤«¤·¿®¹æ£Â¤Ï¥¤¥Ù¥ó¥È¤â¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤âȯÀ¸¤·¤Ê¤¤¡£¤³¤ì¤Ï¡¢£Â¤Ø¤ÎÂåÆþ¤¬È¯À¸¤¹¤ë¤¿¤á¤Ë¤Ï¿®¹æ£Á¤ËÂФ·¤Æ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Ç¤Ï̵¤¯¥¤¥Ù¥ó¥È¤¬É¬Íפˤʤ뤿¤á¤Ç¤¢¤ë¡£


    process begin
        wait for 1 ns;
        A <= '1'
    end process;
    B <= A;


¤â¤¦¾¯¤·Ê£»¨¤ÊÎã¤ò£Í£ï£ä£å£ì£Ó£é£í¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤·¤ÆÆ°ºî¤ò¸«¤Æ¤ß¤ë¤³¤È¤Ë¤¹¤ë¡£
°Ê²¼¤Ë¥µ¥ó¥×¥ë¥½¡¼¥¹¤ò¾Ò²ð¤¹¤ë¡£
¤³¤ì¤Ï¡¢Ã±½ã¤Ê£²ÆþÎϤΣϣҤǣ±ËܤÎÆþÎϤÏ'1'¸ÇÄê¡¢¤â¤¦£±ËܤÏ5nsËè¤Ë'1'/'0'¤ò·«¤êÊÖ¤·¤Æ¤¤¤ë¡£¤¿¤À¤·'1'¤Î¸ÇÄêÃͤâ¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤òȯÀ¸¤µ¤»¤ë¤¿¤á¤Ë5nsËè¤ËÂåÆþ¤ò·«¤êÊÖ¤·¤Æ¤¤¤ë¡£
¤½¤·¤Æ³Æ¿®¹æ¤Î¥¤¥Ù¥ó¥È¤È¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ò¥«¥¦¥ó¥È¤·¤ÆÊѲ½¤ò³Îǧ¤¹¤ë¡£

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity test is
end test;

architecture behavior of test is

    signal  DATA1       : std_logic := '1';
    signal  DATA2       : std_logic := '1';
    signal  DATA3       : std_logic := '1';
    signal  DATA1_TR    : integer := 0;
    signal  DATA1_EV    : integer := 0;
    signal  DATA2_TR    : integer := 0;
    signal  DATA2_EV    : integer := 0;
    signal  DATA3_TR    : integer := 0;
    signal  DATA3_EV    : integer := 0;

begin

    process begin
        wait for 5 ns;
        DATA1 <= '1' after 1 ns;
        wait for 5 ns;
        DATA1 <= '1' after 2 ns;
        wait for 5 ns;
        DATA1 <= '1' after 1 ns;
        wait for 5 ns;
        DATA1 <= '1' after 2 ns;
    end process;

    process begin
        wait for 5 ns;
        DATA2 <= '0' after 1 ns;
        wait for 5 ns;
        DATA2 <= '1' after 2 ns;
        wait for 5 ns;
        DATA2 <= '0' after 2 ns;
        wait for 5 ns;
        DATA2 <= '1' after 1 ns;
    end process;

    DATA3 <= DATA1 or DATA2;

    -- ¥È¥é¥ó¥¶¥¯¥·¥ç¥óȯÀ¸¤Ç¥«¥¦¥ó¥È¥¢¥Ã¥×
    process begin
        wait on DATA1'transaction;
        DATA1_TR <= DATA1_TR + 1;
    end process;
    process begin
        wait on DATA2'transaction;
        DATA2_TR <= DATA2_TR + 1;
    end process;
    process begin
        wait on DATA3'transaction;
        DATA3_TR <= DATA3_TR + 1;
    end process;

    -- ¥¤¥Ù¥ó¥ÈȯÀ¸¤Ç¥«¥¦¥ó¥È¥¢¥Ã¥×
    process begin
        wait on DATA1;
        DATA1_EV <= DATA1_EV + 1;
    end process;
    process begin
        wait on DATA2;
        DATA2_EV <= DATA2_EV + 1;
    end process;
    process begin
        wait on DATA3;
        DATA3_EV <= DATA3_EV + 1;
    end process;

end behavior;


¤³¤ì¤Î·ë²Ì¤Ï¡¢

delta_out.gif

 

 

 

 

 

¤³¤ÎÍͤˤʤ롣°ì¤Ä¤º¤Ä¸«¤Æ¤¤¤¯¤È¡¢
DATA1¤ÈDATA3¤Î¥¤¥Ù¥ó¥È¤ÏÊѲ½¤¬¤Ê¤¤¡£¤³¤ì¤ÏÀè¤Û¤É¤ÎÀâÌÀ¤ÎÄ̤ꡣ
DATA2¤Î¥¤¥Ù¥ó¥È¤È¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÏƱ¤¸¤Ç¡¢¤³¤ì¤ÏÄ̾ï¤ÎÆ°ºî¡£
DATA1¤ÈDATA2¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤Ï¥Ç¥£¥ì¥¤Ãͤϰ㤦¤¬ÂåÆþ»þ¤ËÊѲ½¤¹¤ë¡£
DATA3¤Î¥È¥é¥ó¥¶¥¯¥·¥ç¥ó¤ÏDATA2¤Î¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤¿»þ¤ËÂåÆþ¤¬È¯À¸¤¹¤ë¤Î¤Ç¤½¤Î¥¿¥¤¥ß¥ó¥°¤ÇÊѲ½¤¹¤ë¡£
Ƭ¤¬º®Í𤷤½¤¦¤Ë¤Ê¤ë¤¬¤¸¤Ã¤¯¤ê¹Í¤¨¤ë¤ÈÍý²ò¤Ç¤­¤ë¤È¤ª¤â¤¦¡£



Åê¹Æ»þ¹ï(22:10)¨¢¥³¥á¥ó¥È(2)¨¢VHDL 

2007ǯ08·î06Æü

ModelSim¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥ê¡¼¥É¥é¥¤¥È

£Í£ï£ä£å£ì£Ó£é£í¡Ü£Ö£È£Ä£Ì¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥ê¡¼¥É¥é¥¤¥È¤ò¹Ô¤¨¤ë¥â¥¸¥å¡¼¥ë¤òºîÀ®Ãæ¤À¤¬¡¢»×¤Ã¤¿¤è¤¦¤Ë»þ´Ö¤¬¤È¤ì¤Ê¤¤¤Î¤ÇÆñ¹Ò¤·¤Æ¤¤¤ë¡£
¤È¤ê¤¢¤¨¤º¥Ñ¥Ã¥±¡¼¥¸¤À¤±½ÐÍ褿¤Î¤Ç¸ø³«¡£¡Ê¥Ü¥Ç¥£¤ÏȾʬ¤¯¤é¤¤¡Ë¤³¤ì¤òºî¤ë¤Î¤Ë¡Ötextio.vhd¡×¤Ï¤È¤Æ¤â»²¹Í¤Ë¤Ê¤ë¡£°ìÅÙÌܤòÄ̤¹¤³¤È¤ò¤ª¤¹¤¹¤á¤·¤¿¤¤¡£
¤³¤ì¤¬½ÐÍè¤ë¤È£Í£ï£ä£å£ì£Ó£é£í£Ø£Å £Ó£ô£á£ò£ô£å£ò¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×¤òľÀÜ°·¤¦¤³¤È¤¬½ÐÍè¤ë¡£
»ä¤Î»Å»ö¾å¡¢²èÁü¥Õ¥¡¥¤¥ë¤ò°·¤¦¤³¤È¤¬Â¿¤¤¤Î¤Ç¤³¤ì¤¬½ÐÍè¤ë¤È£Í£ï£ä£å£ì£Ó£é£í¤Î¥é¥¤¥»¥ó¥¹¤¬¶õ¤¤¤Æ¤¤¤Ê¤¤»þ¤Ë¤â¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤¬½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ë¡££Í£ï£ä£å£ì£Ó£é£í£Ó£Å¤À¤È£Æ£Ì£É¤¬»È¤¨¤ë¤Î¤ÇÁ°¤Ëºî¤Ã¤¿¥³¥ì¤Ç¤â½ÐÍè¤ë¤¬¡¥¡¥¡¥


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

package bmp_pkg is

    ----------------------------------------------------------------------------
    -- ¥Ç¡¼¥¿¥¿¥¤¥×ÄêµÁ
    ----------------------------------------------------------------------------
    -- ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥ÀÄêµÁ
    type    BITMAPFILEHEADER    is record
        bfType              :   bit_vector(15 downto 0);
        bfSize              :   bit_vector(31 downto 0);
        bfReserved1         :   bit_vector(15 downto 0);
        bfReserved2         :   bit_vector(15 downto 0);
        bfOffBits           :   bit_vector(31 downto 0);
    end record;

    -- ¥¤¥ó¥Õ¥©¥Ø¥Ã¥ÀÄêµÁ
    type    BITMAPINFOHEADER    is record
        biSize              :   bit_vector(31 downto 0);
        biWidth             :   bit_vector(31 downto 0);
        biHeight            :   bit_vector(31 downto 0);
        biPlanes            :   bit_vector(15 downto 0);
        biBitCount          :   bit_vector(15 downto 0);
        biCompression       :   bit_vector(31 downto 0);
        biSizeImage         :   bit_vector(31 downto 0);
        biXPelsPerMeter     :   bit_vector(31 downto 0);
        biYPelsPerMeter     :   bit_vector(31 downto 0);
        biClrUsed           :   bit_vector(31 downto 0);
        biClrImportant      :   bit_vector(31 downto 0);
    end record;

    -- ¥Ñ¥ì¥Ã¥ÈÄêµÁ
    type    RGBQUAD             is record
        rgbBlue             :   bit_vector(7 downto 0);
        rgbGreen            :   bit_vector(7 downto 0);
        rgbRed              :   bit_vector(7 downto 0);
        rgbReserved         :   bit_vector(7 downto 0);
    end record;

    -- ¥Ñ¥ì¥Ã¥È¤Î¥Ý¥¤¥ó¥¿ÄêµÁ
    type    RGBQUADARRAY        is array( natural range <> ) of RGBQUAD;
    type    RGBQUADACCESS       is access RGBQUADARRAY;

    -- ¥Ð¥¤¥È¤Î¥Ý¥¤¥ó¥¿ÄêµÁ
    subtype BYTE                is bit_vector(7 downto 0);
    type    BYTEARRAY           is array( natural range <> ) of BYTE;
    type    BYTEACCESS          is access BYTEARRAY;

    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×Á´ÂΤòÄêµÁ
    type    BMP_INFO            is record
        bmp_fh              :   BITMAPFILEHEADER;
        bmp_ih              :   BITMAPINFOHEADER;
        col_tbl             :   RGBQUADACCESS;
        pix_data            :   BYTEACCESS;
    end record;

    -- ¥Õ¥¡¥¤¥ë¥¿¥¤¥×ÄêµÁ
    type    BIN             is file of character;

    ----------------------------------------------------------------------------
    -- ¸ø³«¥µ¥Ö¥×¥í¥°¥é¥àÄêµÁ
    ----------------------------------------------------------------------------
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×¥ª¡¼¥×¥ó¡Ê¥Õ¥¡¥¤¥ë»ØÄê¡Ë
    procedure open_bmp (
                            filename        : in    string;
                            bmp_info_data   : out   BMP_INFO;
                            result          : out   boolean
                        );
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×¥ª¡¼¥×¥ó¡Ê¶õ¥Ç¡¼¥¿¡Ë
    procedure open_bmp (
                            x_size          : in    std_logic_vector(31 downto 0);
                            y_size          : in    std_logic_vector(31 downto 0);
                            bitcount        : in    integer;
                            bmp_info_data   : out   BMP_INFO;
                            result          : out   boolean
                        );
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×Êݸ
    procedure save_bmp (
                            filename        : in    string;
                            bmp_info_data   : inout BMP_INFO;
                            result          : out   boolean
                        );
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×¥¯¥í¡¼¥º
    procedure close_bmp (
                            bmp_info_data   : inout BMP_INFO;
                            result          : out   boolean
                        );
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×¥ê¡¼¥É
    procedure read_bmp (
                            x_pos           : in    std_logic_vector(31 downto 0);
                            y_pos           : in    std_logic_vector(31 downto 0);
                            pix_data        : out   std_logic_vector(31 downto 0);
                            bmp_info_data   : inout BMP_INFO
                        );
    -- ¥Ó¥Ã¥È¥Þ¥Ã¥×¥é¥¤¥È
    procedure write_bmp (
                            x_pos           : in    std_logic_vector(31 downto 0);
                            y_pos           : in    std_logic_vector(31 downto 0);
                            pix_data        : in    std_logic_vector(31 downto 0);
                            bmp_info_data   : inout BMP_INFO
                        );

end bmp_pkg;




2007ǯ08·î03Æü

VHDL TIPS ¡Ö¥Ç¥£¥Õ¥¡¡¼¥ÉÄê¿ô¤Î»ÈÍÑË¡¡×

¥Ç¥£¥Õ¥¡¡¼¥ÉÄê¿ô¤È¤¤¤¦Æñ¤·¤½¤¦¤Ê̾Á°¤Î;¤ê°ÕÌ£¤Î̵¤¤µ¡Ç½¤¬¤¢¤ë¡£
¤³¤ì¤Ï¡¢¥Ñ¥Ã¥±¡¼¥¸¤ÇÄê¿ô¤ÎÀë¸À¤À¤±¤·¤Æ¤ª¤­¼ÂºÝ¤ÎÃͤϥѥ屡¼¥¸¥Ü¥Ç¥£¤Ç³ä¤êÅö¤Æ¤ë¤È¤¤¤¦µ¡Ç½¤À¡£Ä̾ï¤Ï¥Ñ¥Ã¥±¡¼¥¸¤È¥Ñ¥Ã¥±¡¼¥¸¥Ü¥Ç¥£¤Ï£±¡§£±¤Çµ­½Ò¤¹¤ë¤È»×¤¦¤Î¤Ç¥Ç¥£¥Õ¥¡¡¼¥ÉÄê¿ô¤Ë¤¹¤ë¤È;·×¤Ë¤ä¤ä¤³¤·¤¯¤Ê¤ë¡£
¥Ñ¥Ã¥±¡¼¥¸¥Ü¥Ç¥£¤Ç¤Ï̵¤¯¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤ÇÃͤò³ä¤êÅö¤Æ¤ë»ö¤¬½ÐÍè¤ì¤Ð¡¢Äê¿ôÀë¸À¤ò¶¯À©¤Ç¤­¤ë¤È¤¤¤¦°ÕÌ£¤Ç¡¢¤Þ¤À»È¤¨¤¿¤Î¤«¤â¤·¤ì¤Ê¤¤¤¬¡¢¤³¤ì¤Ï½ÐÍ褺¤¢¤¯¤Þ¤Ç¤â¥Ñ¥Ã¥±¡¼¥¸¥Ü¥Ç¥£Æâ¤Ë¸Â¤é¤ì¤Æ¤¤¤ë¡£
̵Íý¤Ë»È¤ª¤¦¤È»×¤¨¤Ð¡¢¥Ñ¥Ã¥±¡¼¥¸¤À¤±¥é¥¤¥Ö¥é¥ê¤Î¤è¤¦¤Ë¤·¤Æ¥Ñ¥Ã¥±¡¼¥¸¥Ü¥Ç¥£¤Ï¥Ñ¥Ã¥±¡¼¥¸¥æ¡¼¥¶¤Ëºî¤é¤»Äê¿ôÀë¸À¤ò¶¯À©¤µ¤»¤¿¤¤¾ì¹ç¤¯¤é¤¤¤À¤í¤¦¤«¡£
¤¿¤À¡¢¤³¤Î¾ì¹ç¤â£Ø£Ó£Ô¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤À¤±¤Ë¤·¤Æ¤ª¤¤¤¿Êý¤¬Îɤ¤¡£

°Ê²¼¤Ë»ÈÍÑÎã¤ò¾Ò²ð¤¹¤ë¡£


package test_pkg is
    -- ¥Ç¥£¥Õ¥¡¡¼¥ÉÄê¿ô
    constant    const_int   : integer;
end test_pkg;

package body test_pkg is
    -- ¥Ç¥£¥Õ¥¡¡¼¥ÉÄê¿ô¤ÎÄê¿ô·èÄê
    constant    const_int   : integer := 10;
end test_pkg;




Åê¹Æ»þ¹ï(20:28)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ08·î02Æü

ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÁàºî¡×

°ÊÁ°¡¢¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤È½ñ¤­¹þ¤ß¤ò¾Ò²ð¤·¤¿¤¬¡¢¤½¤Î»þ¡¢¡Ö¥Õ¥¡¥¤¥ë¤òºÇ¸å¤Þ¤ÇÆɤ߽Ф·¤¿»ö¤¬Ê¬¤«¤é¤ººÇ¸å¤Î¼¡¤òÆɤ߽Ф½¤¦¤È¤·¤¿½Ö´Ö¤Ë£Æ£á£ô£á£ì¥¨¥é¡¼¤È¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£¡×¤È½ñ¤¤¤¿¡£
¤·¤«¤·¡¢£Å£Ï£Æ¡Ê¥¨¥ó¥É¥ª¥Ö¥Õ¥¡¥¤¥ë¡Ë¤ò¸¡½Ð½ÐÍè¤ë´Ø¿ô¤¬¤¢¤ë¤³¤È¤òÃΤ俤Τǡ¢¤½¤ì¤ò»È¤Ã¤Æ°ÊÁ°¤Î¥µ¥ó¥×¥ë¤ò½ñ¤­Ä¾¤¹»ö¤Ë¤¹¤ë¡£

°Ê²¼¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ßSTD_LOGIC_VECTOR¤ËÊÑ´¹¤·¤Æ¤«¤é¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤ß¤ò¹Ô¤¦¡£Íפϥե¡¥¤¥ë¤Î¥³¥Ô¡¼¤ò¹Ô¤¦¡£
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity bin_rw is
end bin_rw;

architecture behavior of bin_rw is

    type    BIN is file of character;
    file    FILEIN      :   BIN open READ_MODE  is "binary_in.bin";
    file    FILEOUT     :   BIN open WRITE_MODE is "binary_out.bin";

    signal  BYTEDATA     :   std_logic_vector(7 downto 0);

begin

    process
        variable    FREAD_CHAR   :   character;
        variable    FWRITE_CHAR  :   character;
    begin
        -- ¥Õ¥¡¥¤¥ë¤Î½ª¤ï¤ê¤ò¸¡½Ð¤¹¤ë¤Þ¤Ç¥ë¡¼¥×
        while ( endfile( FILEIN ) = FALSE ) loop
            -- ¥Õ¥¡¥¤¥ë¥ê¡¼¥É
            read( FILEIN, FREAD_CHAR );

            -- std_logic_vector¤ËÊÑ´¹¡Êº£²ó¤ÏÊÑ´¹¤¹¤ë°ÕÌ£¤Ï̵¤¤¤¬¡¢»²¹Í¤Î¤¿¤á¡Ë
            BYTEDATA <= conv_std_logic_vector( character'pos(FREAD_CHAR), 8 );

            -- ¥Ç¥ë¥¿ÃÙ±ä¤òÆþ¤ì¤ÆBYTEDATA¤ò¹¹¿·
            wait for 0 ns;

            -- character¤ËÊÑ´¹¡Êº£²ó¤ÏÊÑ´¹¤¹¤ë°ÕÌ£¤Ï̵¤¤¤¬¡¢»²¹Í¤Î¤¿¤á¡Ë
            FWRITE_CHAR := character'val( conv_integer(BYTEDATA) );

            -- ¥Õ¥¡¥¤¥ë¥é¥¤¥È
            write( FILEOUT, FREAD_CHAR );
        end loop;
        wait;
    end process;

end behavior;



º£²ó¤Ï¡¢while¤Ç£Å£Ï£Æ¤ò¸¡½Ð¤¹¤ë¤Þ¤Ç̵¸Â¥ë¡¼¥×¤·¤Æ¤¤¤ë¤Î¤Ç£Æ£á£ô£á£ì¥¨¥é¡¼¤È¤Ê¤ë¤³¤È¤Ï¤Ê¤¤¡£¤¿¤À¤·¡¢¥ë¡¼¥×Ãæ¤Ë¥Ç¥ë¥¿ÃÙ±ä¤òÆþ¤ì¤Æ¤¤¤ë¤Î¤ÇÂ礭¤Ê¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¢£Í£ï£ä£å£ì£ó£é£í¤Î¥ê¥ß¥Ã¥È¤Ç¥¹¥È¥Ã¥×¤µ¤ì¤Æ¤·¤Þ¤¦¤«¤â¤·¤ì¤Ê¤¤¡£¤³¤Î¾ì¹ç¤Ï¡¢¥¦¥¨¥¤¥È¤ÎÃͤˣ±°Ê¾å¤òÆþ¤ì¤ë¤«£Í£ï£ä£å£ì£ó£é£í¤Î¥á¥Ë¥å¡¼¤«¤é¡ÖSimulate¡×¢ª¡ÖRuntime Option¡×¢ªDefaults¥¿¥Ö¤Î¡ÖIteration Limit¡×¤ÎÃͤòÂ礭¤¯¤¹¤ë¡£



2007ǯ07·î31Æü

VHDL TIPS ¡Öincomplete type¤Î»ÈÍÑË¡¡×

VHDL TIPS ¡Öaccess type¤Î»ÈÍÑË¡¡×¤Ë´ØÏ¢¤·¤Æ¡Öincomplete type¡×¤ò¾Ò²ð¤¹¤ë¡£

¥½¥Õ¥È¥¦¥§¥¢¤Ç¤Ï¡¢Ê£¿ô¤Î¥Ç¡¼¥¿¤ò´ÉÍý¤¹¤ë»þ¡¢¼¡¤Î¥Ç¡¼¥¿¥Ý¥¤¥ó¥¿¤ò¼«Ê¬¤Î¥Ç¡¼¥¿Æâ¤Ë´Þ¤á¤Æ¥Á¥§¡¼¥ó¤µ¤»¤ë¤è¤¦¤Ê»ö¤¬¤è¤¯¤¢¤ë¡£
¤³¤ì¤òɽ¸½¤¹¤ë¤Ë¤Ï¡¢¥Ý¥¤¥ó¥¿¤È¥Ç¡¼¥¿¥Ñ¥Ã¥­¥ó¥°¤Î¹Í¤¨Êý¤¬É¬ÍפÀ¤È»×¤¦¤¬¡¢£Ö£È£Ä£Ì¤Ç¤Ïaccess type¤Èrecord¡¡type¤¬¤¢¤ë¤Î¤Ç¡¢¤³¤ÎÅÀ¤Ç¤ÏÌäÂê¤Ï¤Ê¤¤¡£
¤¿¤À¡¢£Ö£È£Ä£Ì¤Ç¤Ïaccess type¤Ç¥Ý¥¤¥ó¥¿¤òÄêµÁ¤¹¤ë»þ¤Ë¤Ï¡¢record¡¡type¤ÎÄêµÁ¤¬É¬Íפǡ¢record¡¡type¤Ç¥Ç¡¼¥¿¥Ñ¥Ã¥­¥ó¥°¤òÄêµÁ¤¹¤ë»þ¤Ë¤Ï¡¢access type¤ÎÄêµÁ¤¬É¬Íפˤʤ롣¤³¤ÎÌ·½â¤ò²óÈò¤¹¤ë»þ¤Ë¡Öincomplete type¡×¤ò»ÈÍѤ¹¤ë¡£

»ÈÍÑÊýË¡¤Ï´Êñ¤Ç¡¢¤¢¤È¤Ç»ÈÍѤ¹¤ë̾Á°¤òÀè¤ËtypeÀë¸À¤·¤Æ¤·¤Þ¤¦¤À¤±¤Ç¤¢¤ë¡£

°Ê²¼¤ËÄêµÁÉôʬ¤À¤±¤ÎÎã¤ò¾Ò²ð¤¹¤ë¡£


    -- ¸å¤ÇÄêµÁ¤¹¤ërecord type¤Î̾Á°¤À¤±¤òÀè¤ËÄêµÁ¤¹¤ë(incomplete type)
    type    DATA_PACK;
    -- ²¾¤ËÄêµÁ¤·¤¿Ì¾Á°¤Ç¥Ý¥¤¥ó¥¿¤òÄêµÁ
    type    PACK_PTR  is access DATA_PACK;
    -- ²¾¤ËÄêµÁ¤·¤¿Ì¾Á°¤Ë¼ÂºÝ¤ÎÄêµÁ¤ò³ä¤êÅö¤Æ
    type    DATA_PACK is record
        next_pack   :   PACK_PTR;
        header      :   std_logic_vector(7 downto 0);
        data        :   std_logic_vector(31 downto 0);
    end record;



Åê¹Æ»þ¹ï(21:00)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ07·î30Æü

VHDL TIPS ¡Ö¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹¤Î»ÈÍÑË¡¡×

VHDL¤Ë¤Ï¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹¤È¤¤¤¦Êª¤¬¤¢¤ë¡£
¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹¤È¤Ï¥¨¥ó¥Æ¥£¥Æ¥£Æâ¤Ë¤¢¤ë¥×¥í¥»¥¹¤Î»ö¤Ç¡¢¼ç¤Ë¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Ç¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¥Á¥§¥Ã¥¯Åù¤ò¹Ô¤¦»ö¤¬½ÐÍè¤ë¡£
ƱÍͤΤ³¤È¤¬¥¢¡¼¥­¥Æ¥¯¥Á¥ãÆâ¤Ç¤â²Äǽ¤À¤¬¥¨¥ó¥Æ¥£¥Æ¥£Æâ¤Ç¹Ô¤¦¤³¤È¤Ë¤è¤êÊ£¿ô¤Î¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤ò¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ÇÁªÂò¤¹¤ë¾ì¹ç¤Ê¤É¤Ë¶¦Í­¤Ç¤­¤ë¥á¥ê¥Ã¥È¤¬¤¢¤ë¡£

°Ê²¼¤ÎÎã¤Ç¤Ï¡¢¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹¤Ç¥Ç¡¼¥¿¤Î¥»¥Ã¥È¥¢¥Ã¥×¡¿¥Û¡¼¥ë¥É¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤ë¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity PASSIVE_TEST is
    generic
    (
        SETUP   : in    time := 10 ns;
        HOLD    : in    time := 5 ns
    );
    port
    (
        CLK     : in    std_logic;
        DIN     : in    std_logic;
        DOUT    : out   std_logic
    );

begin
-- XST¤Ï¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤
-- pragma translate_off
    process
        variable    PREV_DIN        : std_logic := 'U';
        variable    PREV_DIN_TIME   : time      := 0 ns;
        variable    PREV_CLK_TIME   : time      := 0 ns;
    begin
        -- CLK¤«DIN¤ËÊѲ½¤¬¤¢¤ì¤Ð¼¡¤Ë¿Ê¤à
        wait on     CLK, DIN;

        -- DIN¤ËÊѲ½¤¬¤¢¤Ã¤¿¾ì¹ç
        if ( DIN /= PREV_DIN ) then
            PREV_DIN_TIME   := now;
            PREV_DIN        := DIN;
            if ( now - PREV_CLK_TIME < HOLD ) then
                assert false
                report "Hold Time was not suitable."
                severity WARNING;
            end if;
        end if;

        -- CLK¤ËÊѲ½¤¬¤¢¤Ã¤¿¾ì¹ç
        if ( CLK'event and CLK = '1' ) then
            PREV_CLK_TIME   := now;
            if ( now - PREV_DIN_TIME < SETUP ) then
                assert false
                report "Setup Time was not suitable."
                severity WARNING;
            end if;
        end if;

    end process;
-- pragma translate_on
end PASSIVE_TEST;

-- ¥Ó¥Ø¥¤¥Ó¥¢£±
architecture BEHAVIOR1 of PASSIVE_TEST is
begin

    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            DOUT <= DIN;
        end if;
    end process;

end BEHAVIOR1;

-- ¥Ó¥Ø¥¤¥Ó¥¢£²
architecture BEHAVIOR2 of PASSIVE_TEST is
begin

    process ( CLK ) begin
        if ( CLK'event and CLK = '1' ) then
            DOUT <= DIN after 2 ns;
        end if;
    end process;

end BEHAVIOR2;


¤³¤ÎÍͤ˥ѥå·¥Ö¥×¥í¥»¥¹¤È¤·¤Æ¥»¥Ã¥È¥¢¥Ã¥×¡¿¥Û¡¼¥ë¥É¤ò¥Á¥§¥Ã¥¯¤¹¤ë»ö¤Ç¡¢¥¢¡¼¥­¥Æ¥¯¥Á¥ã¡ÖBEHAVIOR1 ¡×¤È¡ÖBEHAVIOR£² ¡×¤Ç¶¦Í­¤¹¤ë»ö¤¬¤Ç¤­¤ë¡£
¤¿¤À¤·Ãí°ÕÅÀ¤È¤·¤Æ¡¢¥Ñ¥Ã¥·¥Ö¥×¥í¥»¥¹Æâ¤Ç¤Ï¿®¹æ¡Êsignal¡ËÄêµÁ¤äÂåÆþ¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Ê¤¤¤Î¤ÇprocessÆâ¤Çvariable¤ò»ÈÍѤ¹¤ë¤«¥³¥ó¥«¥ì¥ó¥Èʸ¤ÇľÀܥݡ¼¥È¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤·¤«Ìµ¤¤¡£¤Þ¤¿¡¢£Ø£é£ì£é£î£ø¤Î£Ø£Ó£Ô¤Ç¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤Î¤Çtranslate_off¤¹¤ëɬÍפ⤢¤ë¡£

°Ê²¼¤Ë¾åµ­Îã¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ò´Þ¤á¤¿¥Æ¥¹¥È¥Ù¥ó¥Á¤ò¾Ò²ð¤¹¤ë¡£

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity PASSIVE_TEST_TB is
end PASSIVE_TEST_TB;

architecture behavior of PASSIVE_TEST_TB is

    component PASSIVE_TEST
        generic
        (
            SETUP   : in    time := 10 ns;
            HOLD    : in    time := 5 ns
        );
        port
        (
            CLK     : in    std_logic;
            DIN     : in    std_logic;
            DOUT    : out   std_logic
        );
    end component;

    signal  CLK     : std_logic := '1';
    signal  DIN     : std_logic := '0';
    signal  DOUT    : std_logic := '0';

begin

    U_PASSIVE_TEST : PASSIVE_TEST
    generic map
    (
        SETUP   => 10 ns,
        HOLD    => 5 ns
    )
    port map
    (
        CLK     => CLK,
        DIN     => DIN,
        DOUT    => DOUT
    );

    process begin
        CLK <= '1';
        wait for 50 ns;
        CLK <= '0';
        wait for 50 ns;
    end process;

    process begin
        DIN <= '0' after 3 ns;      -- Hold Error;
        wait for 200 ns;
        DIN <= '1' after 91 ns;     -- Setup Error;
        wait for 200 ns;
    end process;

end behavior;

-- ¥Ó¥Ø¥¤¥Ó¥¢£±¤òÁªÂò
configuration PASSIVE_TEST_CONFIG1 of PASSIVE_TEST_TB is
    for behavior
        for U_PASSIVE_TEST : PASSIVE_TEST use entity work.passive_test(BEHAVIOR1);
        end for;
    end for;
end PASSIVE_TEST_CONFIG1;

-- ¥Ó¥Ø¥¤¥Ó¥¢£²¤òÁªÂò
configuration PASSIVE_TEST_CONFIG2 of PASSIVE_TEST_TB is
    for behavior
        for U_PASSIVE_TEST : PASSIVE_TEST use entity work.passive_test(BEHAVIOR2);
        end for;
    end for;
end PASSIVE_TEST_CONFIG2;


¤³¤ì¤ò£Í£ï£ä£å£ì£ó£é£í¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤¹¤ë¤È¡¢Î¾Êý¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤Ç¥¢¥µ¡¼¥·¥ç¥ó¤¬Í­¸ú¤Ç¤¢¤ë¤³¤È¤¬Ê¬¤«¤ë¡£



Åê¹Æ»þ¹ï(22:06)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ07·î27Æü

¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥Ç¥ë¥¿

£Ö£È£Ä£Ì¤òÍý²ò¤¹¤ë¾å¤Ç¡Ö¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥Ç¥ë¥¿¡×¤Ï½ÅÍפʹàÌܤÀ¤È»×¤¦¡£
¤·¤«¤·¡¢Íý²ò¤»¤º¤ËÀ߷פò¹Ô¤Ã¤Æ¤â¡¢À߷ס¿¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤¬ÌäÂê¤Ê¤¯¹Ô¤¨¤ë»ö¤¬Â¿¤¯Â¸ºß¼«ÂΤòÃΤé¤Ê¤¤¿Í¤â¤¤¤ë¡Ê¤«¤Ä¤Æ¤Î»ä¡¥¡¥¡¥¡Ë¡£
¤·¤«¤·¡¢¤³¤ì¤òÍý²ò½ÐÍè¤Æ¤¤¤Ê¤¤¤È¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤È¼Âµ¡¤ÎÆ°ºîÉÔ°ìÃפò°ú¤­µ¯¤³¤¹»ö¤¬¤¢¤ë¡£

°Ê²¼¤Ï¤½¤ÎÎã¤À¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity DD_TEST is
end DD_TEST;

architecture behavior  of DD_TEST is

    signal  CLK0    : std_logic;
    signal  CLK1    : std_logic;
    signal  COUNT   : std_logic_vector(3 downto 0) := (others => '0');
    signal  CNT_OK  : std_logic_vector(3 downto 0) := (others => '0');
    signal  CNT_NG  : std_logic_vector(3 downto 0) := (others => '0');

begin

    -- ¥¯¥í¥Ã¥¯À¸À®
    process begin
        CLK0 <= '0';
        wait for 10 ns;
        CLK0 <= '1';
        wait for 10 ns;
    end process;

    -- ¥¯¥í¥Ã¥¯¤òÊ£À½
    CLK1 <= CLK0;

    -- CLK0¤ÇCOUNT¤ò¥¤¥ó¥¯¥ê¥á¥ó¥È
    process ( CLK0 ) begin
        if ( CLK0'event and CLK0 = '1' ) then
            COUNT <= COUNT + '1';
        end if;
    end process;

    -- COUNT¤òCLK0¤Ç£±ÃÊÃ٤餻¤ë
    process ( CLK0 ) begin
        if ( CLK0'event and CLK0 = '1' ) then
            CNT_OK <= COUNT;
        end if;
    end process;

    -- COUNT¤òCLK1¤Ç£±ÃÊÃ٤餻¤ë
    process ( CLK1 ) begin
        if ( CLK1'event and CLK1 = '1' ) then
            CNT_NG <= COUNT;
        end if;
    end process;

end behavior ;



Ʊ¤¸¡ÖCOUNT¡×¤ò¡ÖCLK0 ¡×¤È¡ÖCLK1 ¡×¤Ç£±¥¯¥í¥Ã¥¯Ãٱ䤵¤»¤¿¤Î¤À¤¬·ë²Ì¤Ï°Ê²¼¤Î¤è¤¦¤Ë¡ÖCNT_OK¡×¤È¡ÖCNT_NG ¡×¤Ç°Û¤Ê¤ë¡£

delta_out.gif

 

 


¼Âµ¡¤Ç¤Ï´üÂÔÄ̤ê¤ÎÆ°ºî¤ò¹Ô¤¦¤Î¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤È¼Âµ¡¤ÎÆ°ºîÉÔ°ìÃפ¬µ¯¤³¤Ã¤Æ¤¤¤ë¡£

¤Ê¤¼¤³¤Î¤è¤¦¤Ê·ë²Ì¤Ë¤Ê¤ë¤«¤È¤¤¤¦¤È¡¢
¡¦£Ã£Ì£Ë£°¤È£Ã£Ì£Ë£±¤ÏƱ¤¸¤è¤¦¤Ë¸«¤¨¤ë¤¬¡¢¿®¹æ¤ÎÂåÆþ¤Ë¤è¤Ã¤Æ¥·¥ß¥å¥ì¡¼¥¿¤ÎÆâÉô¤Ç¤Ï£±¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤Î¤º¤ì¡Ê¥Ç¥ë¥¿ÃÙ±ä¡Ë¤¬È¯À¸¤·¤Æ¤¤¤ë¡£
¡¦£Ã£Ì£Ë£°¤Ç¥¤¥ó¥¯¥ê¥á¥ó¥È¤·¤¿£Ã£Ï£Õ£Î£Ô¤â¡¢£Ã£Ì£Ë£°¤ËÈæ¤Ù¤Æ£±¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤º¤ì¤Æ¤¤¤ë¡£
¤³¤³¤Ç£Ã£Î£Ô¡²£Î£Ç¤Ï£Ã£Î£Ô£±¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸¡Ê£Ã£Ì£Ë£°¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸½èÍý¤Î¼¡¤Î¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¡Ë¤Ç½èÍý¤µ¤ì¤ë¤¬¡¢¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥µ¥¤¥¯¥ë¤Î½èÍýµ¬Äê¤Ë¤è¤ê¡¢¤³¤Î»þ´û¤Ë£Ã£Ï£Õ£Î£Ô¤¬¹¹¿·¤µ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£

Á°Îã¤Ï¡¢¸Î°Õ¤ËÆ°ºîÉÔ°ìÃפòµ¯¤³¤¹¥³¡¼¥É¤òµ­½Ò¤·¤¿¤¬¡¢¼¡¤ÎÎã¤Ç¤Ï£Ö£È£Ä£Ì¤Îµ­½ÒÀ©Ìó¤Î¤¿¤á¤ËÆ°ºîÉÔ°ìÃפòµ¯¤³¤·¤¿Îã¤ò¾Ò²ð¤¹¤ë¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

library unisim;
use unisim.vcomponents.all;

-- ¥¯¥í¥Ã¥¯¥Ð¥Ã¥Õ¥¡¤òÆþ¤ì¤Æ¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë¤òÀ¸À®¤¹¤ë¥â¥¸¥å¡¼¥ë
entity CLKGEN is
    port
    (
        CLK_IN      : in    std_logic;
        CLK_OUT     : out   std_logic;
        CKE         : out   std_logic
    );
end CLKGEN;

architecture behavior  of CLKGEN is

    signal  CLK_BUFF    : std_logic;
    signal  COUNT       : std_logic_vector(3 downto 0) := (others => '0');

begin

    -- £Ø£é£ì£é£î£ø¤Î¥°¥í¡¼¥Ð¥ë¥¯¥í¥Ã¥¯¥Ð¥Ã¥Õ¥¡
    U_BUFG : BUFG port map ( I => CLK_IN, O => CLK_BUFF );
    -- £Ö£È£Ä£Ì¤ÎÀ©Ìó¡Êport¤Çout¤Ë»ØÄꤷ¤¿¿®¹æ¤ÏÆâÉô¤Ç»²¾È½ÐÍè¤Ê¤¤¡Ë¤Î¤¿¤á¡¢
    -- ¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë¤òºî¤ë¥¯¥í¥Ã¥¯¤ò°ìÅÙ¡¢¥í¡¼¥«¥ë¿®¹æ¤ËÆþ¤ì¤ë¡£

    -- ¥¯¥í¥Ã¥¯¤Î½ÐÎÏ
    CLK_OUT <= CLK_BUFF;

    -- ¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë¤òºî¤ë¤¿¤á¤Î¥«¥¦¥ó¥¿
    process ( CLK_BUFF ) begin
        if ( CLK_BUFF'event and CLK_BUFF = '1' ) then
            COUNT <= COUNT + '1';
        end if;
    end process;

    -- ¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë
    process ( CLK_BUFF ) begin
        if ( CLK_BUFF'event and CLK_BUFF = '1' ) then
            if ( COUNT = (COUNT'range => '0') ) then
                CKE <= '1';
            else
                CKE <= '0';
            end if;
        end if;
    end process;

end behavior ;


¤³¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï¡¢¤¢¤ë£Æ£Ð£Ç£Á¤Î¥¯¥í¥Ã¥¯´ØÏ¢¤Î²óÏ©¤òÀ¸À®¤¹¤ë¤¿¤á¤Ëºî¤é¤ì¤¿¤â¤Î¤À¡£¤³¤Î¤è¤¦¤Ë´ØÏ¢À­¤Î¤¢¤ë²óÏ©¤ò°ì¤Ä¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ë¤Þ¤È¤á¤ë»ö¤ÏÉÑÈˤ˹Ԥï¤ì¤Æ¤¤¤ë¤È»×¤¦¡£
¥½¡¼¥¹¥³¡¼¥ÉÃæ¤Î¥³¥á¥ó¥È¤Ë¤â¤¢¤ë¤è¤¦¤Ë¡¢£Ö£È£Ä£Ì¤Ç¤Ï¥Ý¡¼¥È¤Ë½ÐÎϤ¹¤ë¿®¹æ¤ÏÆâÉô¤Ç»²¾È½ÐÍè¤Ê¤¤À©Ì󤬤¢¤ë¡£¤½¤Î¤¿¤á¤³¤ÎÎã¤Î¾ì¹ç¡¢½ÐÎϤ¹¤ë¥¯¥í¥Ã¥¯¤ÈÆâÉô¤Ç»ÈÍѤ¹¤ë¥¯¥í¥Ã¥¯¤¬£±¥Ç¥ë¥¿¥µ¥¤¥¯¥ë¤º¤ì¤Æ¡¢¤³¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤«¤é½ÐÎϤ¹¤ë¥¯¥í¥Ã¥¯¤Ç¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë¤ò»ÈÍѤ¹¤ë¤È¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤È¼Âµ¡¤ÎÆ°ºîÉÔ°ìÃפòµ¯¤³¤¹¡£¡Ê¤¿¤À¤·¤³¤ÎÎã¤Ç¤Ï¥¯¥í¥Ã¥¯¥¤¥Í¡¼¥Ö¥ë¤Î°ÌÁê¤ÏÆ°ºî¤Ë´Ø·¸¤Ê¤¤¤Î¤Ç»ö¼Â¾åÌäÂê¤Ï¤Ê¤¤¤¬¡Ë

¤Á¤Ê¤ß¤Ë¡¢°ÊÁ°¾Ò²ð¤·¤¿¥½¡¼¥¹¥³¡¼¥É¤Ç
   wait for 0 ns;
¤Î¤è¤¦¤Êµ­½Ò¤ò¤·¤¿¤¬¡¢¤³¤ì¤Ï¥Ç¥ë¥¿ÃÙ±ä¤òȯÀ¸¤µ¤»¤Æ¤¤¤ë¡£



Åê¹Æ»þ¹ï(21:19)¨¢¥³¥á¥ó¥È(2)¨¢VHDL 

2007ǯ07·î26Æü

´·À­ÃÙ±ä¤ÈÅÁÇÅÃÙ±ä

VHDL¤Ë¤Ï´·À­ÃÙ±ä¤ÈÅÁÇÅÃÙ±ä¤ÎÃÙ±ä¥â¥Ç¥ë¤¬¤¢¤ë¡£

´·À­ÃÙ±ä¤Ï¤½¤Î̾Á°¤ÎÄ̤괷À­¤ò»ý¤Ã¤Æ¤ª¤ê¡¢´·À­¤ÎÃÍ̤Ëþ¤ÎÉý¤·¤«»ý¤¿¤Ê¤¤¿®¹æ¤Ï½ÐÎϤˤϸ½¤ì¤Ê¤¤¡£µÕ¤Ë´·À­¤ÎÃͰʾå¤ÎÉý¤ò»ý¤Ã¤¿¿®¹æ¤Ï¡¢¤½¤Î¿®¹æÉý¤Ï¤½¤Î¤Þ¤ÞÃÙ±ä»þ´Ö¸å¤Ë½ÐÎϤ˸½¤ì¤ë¡£
¤³¤Î¤è¤¦¤Ê¿¶¤ëÉñ¤¤¤ò¤¹¤ë¤¿¤á¡¢Æ±´ü²óÏ©Åù¤Ç¤Ï£±¥¯¥í¥Ã¥¯¤è¤êÂ礭¤¤ÃÙ±ä¤òÆþ¤ì¤Æ¤·¤Þ¤¦¤È£±¥Ñ¥ë¥¹Éý¤Î¿®¹æ¤Ï½ÐÎϤ˸½¤ì¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£
´·À­ÃÙ±ä¤Ï°Ê²¼¤Î¤è¤¦¤Ëµ­½Ò¤·¡¢¤´¤¯°ìÈÌŪ¤Ë»ÈÍѤ¹¤ë¡£

B <= A after 1000 ns;

ÅÁÇÅÃÙ±ä¤Ï¡¢´·À­ÃÙ±ä¤È°ã¤Ã¤Æ¤É¤Î¤è¤¦¤Ê¿®¹æ¤Ç¤âÃÙ±ä»þ´Ö¸å¤ËÆþÎϤ¬¤½¤Î¤Þ¤Þ½ÐÎϤ˸½¤ì¤ë¡£
ÅÁÇÅÃÙ±ä¤Ï°Ê²¼¤Î¤è¤¦¤Ëµ­½Ò¤·¡¢ÇÛÀþ¤ä¥Ç¥£¥ì¥¤¥é¥¤¥ó¤Î¥â¥Ç¥ê¥ó¥°¤Ë»ÈÍѤ¹¤ë¡£¤¿¤À¤·¥¯¥í¥Ã¥¯¤ËƱ´ü¤·¤¿¿®¹æ¤ÎÇÛÀþ¥â¥Ç¥ê¥ó¥°¤Ï£±¥¯¥í¥Ã¥¯°ÊÆâ¤ÎÃÙ±äÃͤ¬Á°Äó¤À¤È»×¤¦¤Î¤Ç´·À­ÃÙ±ä¤Ç¤âÌäÂê¤Ïµ¯¤­¤Ê¤¤¤¬¡¢ºÇ¶á¤Î¹â®¥·¥ê¥¢¥ë¿®¹æÅù¤ÏÅÁÇÅÃÙ±ä¤ò»ÈÍѤ·¤Ê¤¤¤È¥â¥Ç¥ê¥ó¥°¤¬ÂçÊѤˤʤ롣¡ÊÀΡ¢¾®¤µ¤¤´·À­ÃÙ±ä¤ò¤¤¤¯¤Ä¤âÆþ¤ì¤¿µ­½Ò¤ò¸«¤¿¤³¤È¤¬¤¢¤ë¡¥¡¥¡¥¡Ë

B <= transport A after 1000 ns;

¥·¥ß¥å¥ì¡¼¥¿Â¦¤«¤é¸«¤ë¤È´·À­ÃÙ±ä¤Ï£±¤Ä¤Î¥¤¥Ù¥ó¥È¥Ð¥Ã¥Õ¥¡¤ò»È¤¤¥¤¥Ù¥ó¥È¤¬½Å¤Ê¤ë¤È¾å½ñ¤­¤µ¤ì¤ë¤è¤¦¤ÊÆ°ºî¤ò¹Ô¤¤¡¢ÅÁÇÅÃÙ±ä¤Ï¥¤¥Ù¥ó¥È¤ò̵¸Â¤Î£Æ£É£Æ£Ï¤ËÆþ¤ì¤ë¤è¤¦¤ÊÆ°ºî¤ò¹Ô¤¦¡£
¤³¤Î¤¿¤áÃٱ䤵¤»¤ë¿®¹æ¤ÎºÇ¾®¥¤¥Ù¥ó¥È´Ö³Ö¤¬ÃÙ±ä»þ´Ö°Ê¾å¤Î¾ì¹ç¤Ï´·À­ÃÙ±ä¤ÈÅÁÇÅÃÙ±ä¤Î·ë²Ì¤Ë°ã¤¤¤Ï¤Ê¤¤¡£



Åê¹Æ»þ¹ï(22:06)¨¢¥³¥á¥ó¥È(5)¨¢VHDL 

2007ǯ07·î24Æü

VHDL TIPS ¡Öaccess type¤Î»ÈÍÑË¡¡×

£Ö£È£Ä£Ì¤Ë¤Ï¥¢¥¯¥»¥¹¥¿¥¤¥×¤È¸À¤¦£Ã¸À¸ì¤Î¥Ý¥¤¥ó¥¿¤Î¤è¤¦¤Êµ¡Ç½¤¬¤¢¤ë¡£
¤Û¤È¤ó¤É»ÈÍѤ¹¤ëµ¡²ñ¤Ï̵¤¤¤È»×¤¦¤¬¤ª¤â¤·¤í¤¤µ¡Ç½¤Ê¤Î¤Ç¾Ò²ð¤·¤¿¤¤¡£

£Ã¸À¸ì¤Î¥Ý¥¤¥ó¥¿¤¬Ê¬¤«¤ë¿Í¤Ê¤é°Ê²¼¤Î¥µ¥ó¥×¥ë¤ò¸«¤ÆÍý²ò¤Ç¤­¤ë¤È»×¤¦¡£
¤³¤Î¥µ¥ó¥×¥ë¤Ï£´£Â£á£î£ë¹½À®¤Î¥á¥â¥ê¤ÇºÇ½é¤Ï¥á¥â¥êÎΰè¤ò³ÎÊݤ»¤º¡¢£Â£á£î£ëËè¤ËºÇ½é¤Ë¥¢¥¯¥»¥¹¤¬¤¢¤Ã¤¿¤È¤­¤Ë½é¤á¤Æ¥á¥â¥êÎΰè¤ò³ÎÊݤ·¤Æ¤¤¤ë¡£¤Þ¤¿¡¢¥ê¥»¥Ã¥È¤òÆþ¤ì¤ë¤ÈÁ´¤Æ¤Î¥á¥â¥êÎΰè¤ò³«Êü¤¹¤ë¡£
¡Êµ­½Ò¤È¤·¤Æ¤Ï¥¸¥§¥Í¥ê¥Ã¥¯¤ò»È¤ï¤º¸ÇÄêÃͤˤ·¤Æ¤¤¤¿¤ê¡¢¥á¥â¥ê¤È¤·¤Æ¤âÈó¸úΨ¤«¤Ä̵°ÕÌ£¤Êµ¡Ç½¤¬¤¢¤Ã¤¿¤ê¤¹¤ë¤¬¡¢¤¢¤¯¤Þ¤Ç¥¢¥¯¥»¥¹¥¿¥¤¥×¤Î¥µ¥ó¥×¥ë¤Ê¤Î¤Ç¡¥¡¥¡¥¡Ë


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

-- £±£¶£×£ï£ò£ä£ø£¸£Â£é£ô£ø£´£Â£á£î£ë£ó¤ÎƱ´ü¥á¥â¥ê
entity test_accs is
    port
    (
        CLK         : in    std_logic;                      -- ¥¯¥í¥Ã¥¯
        RST         : in    std_logic;                      -- ¥ê¥»¥Ã¥È
        ADDR        : in    std_logic_vector(3 downto 0);   -- ¥¢¥É¥ì¥¹(16Word=4Bit)
        BA          : in    std_logic_vector(1 downto 0);   -- ¥Ð¥ó¥¯¥¢¥É¥ì¥¹(4Bank=2Bit)
        CS          : in    std_logic;                      -- ¥Á¥Ã¥×¥»¥ì¥¯¥È
        WE          : in    std_logic;                      -- ¥é¥¤¥È¥¤¥Í¡¼¥Ö¥ë
        INDATA      : in    std_logic_vector(7 downto 0);   -- ¥é¥¤¥È¥Ç¡¼¥¿
        OUTDATA     : out   std_logic_vector(7 downto 0)    -- ¥ê¡¼¥É¥Ç¡¼¥¿
    );
end test_accs;

architecture behavior of test_accs is

    -- ¥Ç¡¼¥¿Éý£¸£Â£é£ô¤Î¥µ¥Ö¥¿¥¤¥×
    subtype BUSWIDS     is std_logic_vector(7 downto 0);
    -- £±£¶£×£ï£ò£ä¤Î¥µ¥Ö¥¿¥¤¥×
    subtype ARRAYNUM    is std_logic_vector(15 downto 0);
    -- £±£Â£á£î£ë¤Î¥Ç¡¼¥¿¥¿¥¤¥×
    type    CELLARRAY   is array(ARRAYNUM'range) of BUSWIDS;
    -- £±£Â£á£î£ë¤Î¥¢¥¯¥»¥¹¥¿¥¤¥×¡Ê¥Ý¥¤¥ó¥¿¡Ë
    type    BNKACCESS   is access CELLARRAY;
    -- £±£Â£á£î£ë¤Î¥¢¥¯¥»¥¹¥¿¥¤¥×¤Î£´ÇÛÎó¡Ê¥Ý¥¤¥ó¥¿¤ÎÇÛÎó¡Ë
    type    BNKARRAY    is array(3 downto 0) of BNKACCESS;

begin

    process
        -- ¥¢¥¯¥»¥¹¥¿¥¤¥×¤Î£´ÇÛÎó¤ò¥¤¥ó¥¹¥¿¥ó¥¹
        variable    BANK        : BNKARRAY := (others => NULL);

        variable    BA_INT      : integer;
        variable    ADDR_INT    : integer;
    begin

        -- ¥¯¥í¥Ã¥¯¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸¤ÇÆ°ºî¤¹¤ë
        wait until CLK = '1';

        -- ¥Ç¡¼¥¿·¿ÊÑ´¹
        BA_INT := conv_integer(BA);
        ADDR_INT := conv_integer(ADDR);

        -- ¥Á¥Ã¥×¥»¥ì¥¯¥È¤¬¥¤¥Í¡¼¥Ö¥ë¤ÇÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Ð¥ó¥¯¤Ë
        -- ¥á¥â¥ê¤¬³ä¤êÅö¤¿¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç
        if ( RST = '0' and CS = '1' and BANK(BA_INT) = NULL ) then
            -- ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥Ð¥ó¥¯¤Ë¥á¥â¥ê¤ò³ÎÊݤ¹¤ë
            BANK(BA_INT) := new CELLARRAY;
            -- ³ÎÊݤ·¤¿¥á¥â¥êÎΰè¤ò£°¥¯¥ê¥¢¤¹¤ë
            for i in ARRAYNUM'range loop
                BANK(BA_INT)(i) := BUSWIDS'(others => '0');
            end loop;
        end if;

        -- ¥Á¥Ã¥×¥»¥ì¥¯¥È¤¬¥¤¥Í¡¼¥Ö¥ë¤Ç¥é¥¤¥È¥¤¥Í¡¼¥Ö¥ë¤¬¥¤¥Í¡¼¥Ö¥ë¤Î¾ì¹ç
        if ( RST = '0' and CS = '1' and WE = '1' ) then
            -- ¥á¥â¥ê¤Ë¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à
            BANK(BA_INT)(ADDR_INT) := INDATA;
        end if;

        -- ¥Á¥Ã¥×¥»¥ì¥¯¥È¤¬¥¤¥Í¡¼¥Ö¥ë¤Î¾ì¹ç
        if ( RST = '0' and CS = '1' ) then
            -- ¥á¥â¥ê¤«¤é¥Ç¡¼¥¿¤òÆɤ߽Ф¹
            OUTDATA <= BANK(BA_INT)(ADDR_INT);

        -- ¥Á¥Ã¥×¥»¥ì¥¯¥È¤¬¥¤¥Í¡¼¥Ö¥ë¤Ç¤Ê¤¤¾ì¹ç
        else
            -- ¥Ç¡¼¥¿¤ò¼å¤¤£È£É£Ç£È¡Ê¥×¥ë¥¢¥Ã¥×¡Ë¤Ë¤¹¤ë
            OUTDATA <= (others => 'H');
        end if;

        -- ¥ê¥»¥Ã¥È¤¬¥¤¥Í¡¼¥Ö¥ë¤Î¾ì¹ç
        if ( RST = '1' ) then
            -- ¥á¥â¥ê³ä¤êÅö¤Æ¤ò²òÊü¤¹¤ë
            for i in BNKARRAY'range loop
                if ( BANK(i) /= NULL ) then
                    deallocate(BANK(i));
                    BANK(i) := NULL;
                end if;
            end loop;
        end if;

    end process;

end behavior;



¤Þ¤È¤á¤È¤·¤Æ¡¢¥µ¥ó¥×¥ë¥³¡¼¥É¤Ç¤Î¥¢¥¯¥»¥¹¥¿¥¤¥×¤Ï¡¢
    type    BNKACCESS   is access CELLARRAY;
¤Ç¥¢¥¯¥»¥¹¥¿¥¤¥×¤òÄêµÁ¤·¤Æ¡¢
        variable    BANK        : BNKARRAY := (others => NULL);
¤Ç¥¢¥¯¥»¥¹¥¿¥¤¥×¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤·¡¢
            BANK(BA_INT) := new CELLARRAY;
¤Ç¥á¥â¥êÎΰè¤ò³ä¤êÅö¤Æ¡¢
                deallocate(BANK(i));
¤Ç¥á¥â¥êÎΰè¤ò³«Êü¤¹¤ë¡£
°Ê¾å¤Î¤è¤¦¤Êή¤ì¤Ç»ÈÍѤ·¤Æ¤¤¤ë¡£

¤³¤ì¤Ë´ØÏ¢¤·¤Æº£Å٤ϡÖincomplete type¡×¤ò¾Ò²ð¤·¤è¤¦¤È»×¤¦¡£



Åê¹Æ»þ¹ï(12:32)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ07·î22Æü

ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤Î½ñ¤­¹þ¤ß¡×

º£²ó¤Ï¡¢¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤Î½ñ¤­¹þ¤ß¤ò¥Æ¥¹¥È¤·¤¿¡£

°Ê²¼¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ßSTD_LOGIC_VECTOR¤ËÊÑ´¹¤·¤Æ¤«¤é¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤ß¤ò¹Ô¤¦¡£Íפϥե¡¥¤¥ë¤Î¥³¥Ô¡¼¤ò¹Ô¤¦¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity bin_rw is
end bin_rw;

architecture behavior of bin_rw is

    type    BIN is file of character;
    file    FILEIN      :   BIN open READ_MODE  is "binary_in.bin";
    file    FILEOUT     :   BIN open WRITE_MODE is "binary_out.bin";

    signal  BYTEDATA     :   std_logic_vector(7 downto 0);

begin

    process
        variable    FREAD_CHAR   :   character;
        variable    FWRITE_CHAR  :   character;
    begin
        for i in 0 to 255 loop
            read( FILEIN, FREAD_CHAR );
            BYTEDATA <= conv_std_logic_vector( character'pos(FREAD_CHAR), 8 );

            wait for 0 ns;

            FWRITE_CHAR := character'val( conv_integer(BYTEDATA) );
            write( FILEOUT, FREAD_CHAR );
        end loop;
        wait;
    end process;

end behavior;


¤³¤ì¤ò¼Â¹Ô¤¹¤ë¤È¡Öbinary_in.bin¡×¤ÈƱ¤¸ÆâÍƤΡÖbinary_out.bin¡×¥Õ¥¡¥¤¥ë¤¬À¸À®¤µ¤ì¤ë¡£¡Ê¥½¡¼¥¹¥³¡¼¥É¤È¡Öbinary_in.bin¡×¤òÃÖ¤¤¤Æ¤ª¤¯¡Ë

¤¿¤ÀÁ°²óƱÍͤˡ¢¤³¤ì¤Ï£Í£ï£ä£å£ì£Ó£é£í¤Ç¤ÎÆ°ºî¤ò³Îǧ¤·¤¿¤À¤±¤ÇÊݾڤµ¤ì¤Æ¤¤¤ëÌõ¤Ç¤Ï¤Ê¤¯¡¢Â¾¤Î¥·¥ß¥å¥ì¡¼¥¿¤Ç¤ÏÆ°ºî¤·¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ë¡£
¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¤òºÇ¸å¤Þ¤ÇÆɤ߽Ф·¤¿»ö¤¬Ê¬¤«¤é¤ººÇ¸å¤Î¼¡¤òÆɤ߽Ф½¤¦¤È¤·¤¿½Ö´Ö¤Ë£Æ£á£ô£á£ì¥¨¥é¡¼¤È¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£¤³¤ì¤ò²óÈò¤¹¤ë¤Ë¤Ï¥Õ¥¡¥¤¥ëÃæ¤Ë¤½¤ì¤¬Ê¬¤«¤ë¾ðÊó¤òÆþ¤ì¤ë¤«»öÁ°¤ËÆɤ߽Ф¹¥µ¥¤¥º¤ò·è¤á¤ë¤Ê¤É¤ÎÊýË¡¤¬¹Í¤¨¤é¤ì¤ë¡£
2007/08/02 - £Å£Ï£Æ¤ò¸¡½Ð¤¹¤ëÊýË¡¤òȯ¸«¡¡ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÁàºî¡×¤ò»²¾È¡£

¡Êº£¤Þ¤Ç¡Öprintf¡×¤ò»È¤Ã¤¿¥½¡¼¥¹¥³¡¼¥É¤ò¾Ò²ð¤·¤Æ¤¤¤¿¤¬Ê¸»úÎó¥Ñ¥é¥á¡¼¥¿¤ÎºÇ¸å¤Ë¡ï£î¤¬Æþ¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£¤³¤ì¤¬Æþ¤Ã¤Æ¤¤¤Ê¤¤¤Èɽ¼¨¤¬½Ð¤Æ¤³¤Ê¤¤¡£¤É¤¦¤ä¤éBlog¤ËŽ¤êÉÕ¤±¤¿¤È¤­¤ËÈ´¤±¤Æ¤·¤Þ¤Ã¤Æ¤¤¤¿¤è¤¦¤À¡£¡Ë


2007ǯ07·î21Æü

½¨´Ý¤Î¶¯Ä´£Ö£È£Ä£Ì¥­¡¼¥ï¡¼¥É¹¹¿·

½¨´Ý¤Î¶¯Ä´£Ö£È£Ä£Ì¥­¡¼¥ï¡¼¥É¥Õ¥¡¥¤¥ë¤ò¹¹¿·¤·¤¿¡£
¹¹¿·ÅÀ¤Ï¡¢¥­¡¼¥ï¡¼¥É¿ôÅÀ¤ÎÄɲäȶ¯Ä´¿§¥Ç¡¼¥¿¤ÎÄɲäÀ¡£
Á°²óƱÍÍ¡¢
¥Õ¥¡¥¤¥ë¤Ï¥³¥³¤«¤é¥À¥¦¥ó¥í¡¼¥É½ÐÍè¤ë¡£
£Ö£å£ò£é£ì£ï£ç¤â¥³¥³¤«¤é¥À¥¦¥ó¥í¡¼¥É½ÐÍè¤ë¡£



Åê¹Æ»þ¹ï(16:35)¨¢¥³¥á¥ó¥È(0)¨¢VHDL 

2007ǯ07·î20Æü

ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¡×

°ÊÁ°¡¢ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ó¥Ã¥È¥Þ¥Ã¥×Áàºî¡×¤ò½ñ¤¤¤¿¤¬¡¢¤³¤ì¤Ï£Í£ï£ä£å£ì£Ó£é£í¤Î£Æ£Ì£Éµ¡Ç½¤ò»È¤Ã¤Æ¤¤¤¿¡£
º£²ó¤Ï¡¢£Æ£Ì£É¤ò»ÈÍѤ»¤º£Ö£È£Ä£Ì¤À¤±¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤òÁàºî¤¹¤ëÊýË¡¤ò¾Ò²ð¤¹¤ë¡£

°Ê²¼¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ßSTD_LOGIC_VECTOR¤ËÊÑ´¹¤·¤Æ£Ô£ò£á£î£ó£ã£ò£é£ð£ô¥¦¥£¥ó¥É¥¦¤Ëɽ¼¨¤¹¤ëÆ°ºî¤ò¹Ô¤¦¡£


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

library c;
use c.stdio_h.all;

entity test_bread is
end test_bread;

architecture behavior of test_bread is

    type    BIN is file of character;
    file    FILEPOINT   :   BIN open READ_MODE is "binary.bin";

    signal  PRINTD      :   std_logic_vector(7 downto 0);

begin

    process
        variable    FREAD_CHAR  :   character;
    begin
        for i in 0 to 255 loop
            read( FILEPOINT, FREAD_CHAR );
            PRINTD <= conv_std_logic_vector(character'pos(FREAD_CHAR), 8 );
            wait for 0 ns;
            printf( "0x%02x ", PRINTD );
        end loop;
        wait;
    end process;

end behavior;


ɽ¼¨¤¹¤ë¤¿¤á¤Ë¡Öfor¡×¤ò»È¤Ã¤¿¤ê¡Ölibrary c;¡×¤Î¡Öprintf¡×¤ò»ÈÍѤ·¤Æ¤¤¤ë¤¬¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ß¤Ë¤Ï°ìÀÚ´Ø·¸¤Ê¤¤¡£
½ÅÍפÊÉôʬ¤Ï¡¢
   type    BIN is file of character;
    file    FILEPOINT   :   BIN open READ_MODE is "binary.bin";
¤³¤ì¤À¤±¤À¡£
¡ÊÆ°ºî¤µ¤»¤ë¤Ë¤ÏÆɤ߽Ф¹ÂоݤÎ"binary.bin"¥Õ¥¡¥¤¥ë¤âɬÍסË

£Æ£Ì£É¤ò»ÈÍѤ·¤Æ¤¤¤Ê¤¤¤Î¤Ç¤â¤·¤«¤¹¤ë¤È£Í£ï£ä£å£ì£Ó£é£í£Ø£Å¤Ç¤âÆ°ºî¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¡£¤³¤ÎÍ×˾¤Ï·ë¹½Â¿¤¤¤Î¤Ç¸å¤Ç¼Â¸³¤·¤Æ¤ß¤è¤¦¤È»×¤¦¡£
2007/07/20 - £Í£ï£ä£å£ì£Ó£é£í£Ø£Å £Ó£ô£á£ò£ô£å£ò¤Ç¤ÎÆ°ºî¤¬³Îǧ¤Ç¤­¤¿¡£

¤¿¤À¡¢¤³¤ì¤Ï£Í£ï£ä£å£ì£Ó£é£í¤Ç¤ÎÆ°ºî¤ò³Îǧ¤·¤¿¤À¤±¤ÇÊݾڤµ¤ì¤Æ¤¤¤ëÌõ¤Ç¤Ï¤Ê¤¯¡¢Â¾¤Î¥·¥ß¥å¥ì¡¼¥¿¤Ç¤ÏÆ°ºî¤·¤Ê¤¤²ÄǽÀ­¤¬¤¢¤ë¡£
¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¤òºÇ¸å¤Þ¤ÇÆɤ߽Ф·¤¿»ö¤¬Ê¬¤«¤é¤ººÇ¸å¤Î¼¡¤òÆɤ߽Ф½¤¦¤È¤·¤¿½Ö´Ö¤Ë£Æ£á£ô£á£ì¥¨¥é¡¼¤È¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£¤³¤ì¤ò²óÈò¤¹¤ë¤Ë¤Ï¥Õ¥¡¥¤¥ëÃæ¤Ë¤½¤ì¤¬Ê¬¤«¤ë¾ðÊó¤òÆþ¤ì¤ë¤«»öÁ°¤ËÆɤ߽Ф¹¥µ¥¤¥º¤ò·è¤á¤ë¤Ê¤É¤ÎÊýË¡¤¬¹Í¤¨¤é¤ì¤ë¡£
2007/08/02 - £Å£Ï£Æ¤ò¸¡½Ð¤¹¤ëÊýË¡¤òȯ¸«¡¡ModelSim TIPS ¡Ö£Í£ï£ä£å£ì£Ó£é£í¤Ç¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÁàºî¡×¤ò»²¾È¡£

¶á¤¤¤¦¤Á¤Ë¡¢¤³¤Îµ¡Ç½¤ò»È¤Ã¤Æ¥Ó¥Ã¥È¥Þ¥Ã¥×¤Î¥ê¡¼¥É¥é¥¤¥È¤¬½ÐÍè¤ë¥â¥¸¥å¡¼¥ë¤òºî¤Ã¤Æ¸ø³«¤·¤è¤¦¤È»×¤¦¡£



2007ǯ07·î18Æü

¥Ò¡¼¥È¥·¥ó¥¯ÁªÄê

£Ö£µ¤Ë»ÈÍѤ¹¤ë¥Ò¡¼¥È¥·¥ó¥¯¤òÁªÄꤹ¤ë»ö¤Ë¤·¤¿¡£
ÁªÄꤹ¤ë¤¿¤á¤Î»ñÎÁ¤È¤·¤Æ°ÊÁ°¤Ï£Õ£Ç£±£±£²¤Ë¥Ñ¥Ã¥±¡¼¥¸¤ÎÆÃÀ­¥Ç¡¼¥¿¤¬µ­ºÜ¤µ¤ì¤Æ¤¤¤¿¤¬¥Ç¥Ð¥¤¥¹¸ÄÊ̤λñÎÁ¤«£×£å£â¤Ç´Êñ¤ËÁªÂò¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
º£²ó¤Ï£×£å£â¤«¤é°Ê²¼¤Î·ë²Ì¤¬ÆÀ¤é¤ì¤¿¡£


Device Family Virtex-5
Device Name XC5VLX50T
Package Name FF665
Unit C/Watt
   
JA (Still Air) 12.1
JA (250 LFM) 7.8
JA (500 LFM) 6.6
JA (750 LFM) 6.1
JB 3.2
JC 0.19


 ºÇ½é¤Ï¤È¤ê¤¢¤¨¤ºÌµÉ÷»þ¤Ç·×»»¤·¤Æ¤ß¤ë¡£
·×»»¤Ï¼¡¤ÎÄ̤ꡢ
£Ô£ê¡Ê¥¸¥ã¥ó¥¯¥·¥ç¥ó²¹ÅÙ¡Ë¡á¡Ê¦Èja¡Ê¥¸¥ã¥ó¥¯¥·¥ç¥ó¤È¼þ°Ï¤Î´Ö¤ÎÇ®Äñ¹³¡Ë¡ß£Ð¡Ê¾ÃÈñÅÅÎÏ¡Ë¡Ë¡Ü£Ô£á¡Ê´Ä¶­²¹ÅÙ¡Ë
¤Ê¤Î¤Ç¡¢´Ä¶­²¹Å٤ϥ·¥¹¥Æ¥à¤ÎÆ°ºîÊݾÚÈϰϾå¸Â¤Î£´£°¡î¡¢¾ÃÈñÅÅÎϤÏÅŸ»¤ÎÁªÄ꤫¤é£·£×¤È½Ð¤Æ¤¤¤ë¤Î¤Ç
£Ô£ê¡á£±£²¡¥£±¡ß£·¡Ü£´£°
£Ô£ê¡á£±£²£´¡¥£·¡î
¤³¤ì¤Ç¤Ï£Æ£Ð£Ç£Á¤ÎºÇÂçÆ°ºîÊݾÚÈϰϤΣ¸£µ¡î¤òÂçÉý¤ËĶ¤¨¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£

¥Ò¡¼¥È¥·¥ó¥¯¤ÎÁªÄê¤Ï¤³¤Î·ë²Ì¤ò£¸£µ¡î¤Ë¤¹¤ë¤¿¤á¤ÎÇ®Äñ¹³¤ò»ý¤Ã¤¿Êª¤òÁªÂò¤¹¤ì¤ÐÎɤ¤¡£
¶ñÂÎŪ¤Ë¤Ï¡¢ºÇÂçÆ°ºîÊݾÚÈϰϤΣ¸£µ¡î¤È¥·¥¹¥Æ¥à¤ÎÆ°ºîÊݾÚÈϰϾå¸Â¤Î£´£°¡î¤È¾ÃÈñÅÅÎÏ£·£×¤«¤é
¦Èja¡á¡Ê£Ô£ê¡Ý£Ô£á¡Ë¡¿£Ð
¦Èja¡á¡Ê£¸£µ¡Ý£´£°¡Ë¡¿£·
¦Èja¡á£¶¡¥£´£³
¤È¤Ê¤ê¡¢Ç®Äñ¹³¤ò£¶¡¥£´£³°Ê²¼¤Ë¤¹¤ì¤ÐÎɤ¤¤³¤È¤¬Ê¬¤«¤ë¡£
¤¿¤À¤·¤³¤Î¦Èja¤Ï¦Èjc¡Ê¥¸¥ã¥ó¥¯¥·¥ç¥ó¤È¥±¡¼¥¹´Ö¤ÎÇ®Äñ¹³¡Ë¤ò´Þ¤ß¤µ¤é¤Ë¥Ò¡¼¥È¥·¥ó¥¯¤ò¤Ä¤±¤ë¾ì¹ç¤Ï¦Èjs¡Ê¥±¡¼¥¹¤È¥Ò¡¼¥È¥·¥ó¥¯´Ö¤ÎÇ®Äñ¹³¡Ë¤â´Þ¤à¤Î¤Ç¤³¤ì¤ò°ú¤¤¤Æ
¦Èsa¡Ê¥Ò¡¼¥È¥·¥ó¥¯¤È¥±¡¼¥¹´Ö¤ÎÇ®Äñ¹³¡Ë¡á¦Èja¡Ý¦Èjc¡Ý¦Èjs
¦Èsa¡á£¶¡¥£´£³¡Ý£°¡¥£±£¹¡Ý£°¡¥£±¡Ê¤³¤ÎÃͤÏŬÅö¡Ë
¦Èsa¡á£¶¡¥£±£´
¤³¤ì¤ÇÇ®Äñ¹³¤¬£¶¡¥£±£´¤Î¥Ò¡¼¥È¥·¥ó¥¯¤òÁªÂò¤¹¤ì¤ÐÎɤ¤¤³¤È¤¬Ê¬¤«¤Ã¤¿¡£

º£²ó¤Ï¡¢¥¢¥ë¥Õ¥¡¼ÒÀ½¤Î¥Ò¡¼¥È¥·¥ó¥¯¤òÁª¤Ö¤³¤È¤Ë¤·¤Æ·¿È֣֡Σµ£´¡Ý£±£µ£Â¡×Êդ꤬ŬÅö¤È¤¤¤¦·ë²Ì¤Ë¤Ê¤Ã¤¿¡£



Åê¹Æ»þ¹ï(19:32)¨¢¥³¥á¥ó¥È(4)¨¢Xilinx¥Ç¥Ð¥¤¥¹ 

2007ǯ07·î16Æü

ÅŸ»¤ÎÁªÄê

ÅŸ»¤ÎÁªÄê¤ò¤¹¤ë»þ¤Ë¤Ï¾ÃÈñÅÅÎϤθ«ÀѤâ¤ê¤¬É¬Íפˤʤ롣
·Ð¸³¤«¤éÂçÂΤÏͽÁۤǤ­¤ë¤Î¤À¤¬¡¢¤½¤ì¤ò³Îǧ¤¹¤ë°Ù¤Ë¤â¥Ä¡¼¥ë¤ò³èÍѤ·¤Æ¤¤¤ë¡£
º£²ó¤Ï¡¢¤¢¤Þ¤ê¾ÜºÙ¤Ê¸«ÀѤâ¤ê¤ÏɬÍפʤ¤¤Î¤Ç£É£Ó£Å¤ËÉÕ°¤Î£Ø£Ð£ï£÷£å£ò¤Ï»ÈÍѤ»¤º£×£å£â¤«¤é£Å£ø£ã£å£ì¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æ¸«ÀѤâ¤ê¤·¤Æ¤ß¤¿¡£
¤Þ¤º£Å£ø£ã£å£ì¥Õ¥¡¥¤¥ë¤Î¥À¥¦¥ó¥í¡¼¥É¤À¤¬¡¢ºÇ¶á¤Î¥Ç¥Ð¥¤¥¹¤Ï¥¹¥×¥ì¥Ã¥É¥·¡¼¥È¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡¢¤¿¤À¾¯¤·Á°¤Î¥Ç¥Ð¥¤¥¹¤Ï¥¦¥§¥Ö¾ÃÈñÅÅÎϥġ¼¥ë¤òÍøÍѤ·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¡£º£²óɬÍפʤΤϣ֣´¤È£Ö£µ¤Ê¤Î¤Ç¥À¥¦¥ó¥í¡¼¥É¤·¤¿¡£

Áᮼ¹Ԥ·¤Æ£Ö£´¤ÏÌ󣶣ס¢£Ö£µ¤ÏÌ󣷣פȤηë²Ì¤¬¤Ç¤¿¡£¤³¤ì¤ÏÁ´ÂΤξÃÈñÅÅÎϤʤΤÇÇ®Âкö¤ò¹Ô¤¦¥Ç¡¼¥¿¤È¤·¤ÆÍøÍѤ¹¤ë¡£¸ÄÊ̤ÎÅŸ»¤Ï¤½¤ì¤¾¤ì£Ö£´¤È£Ö£µ¤Î¶¦Í­¤ä´ðÈĤΥ쥤¥¢¥¦¥È¡¢ÇÛÀþ¡¢Áع½À®¡¢ÁØ¿ôÅù¤ò¹Íθ¤·¤Æ·èÄꤹ¤ë¡£
¤³¤Î»þ¡¢»ä¤¬Ãí°Õ¤·¤Æ¤¤¤ë»ö¤Ï¡¢
¡¦£Ä£Ã¡Ý£Ä£Ã¥³¥ó¥Ð¡¼¥¿¤ÏºÇÂç¾ÃÈñÅÅÎϤÎÌó£µ£°¡óÄøÅÙ¤ò¾å¸Â¤È¤·¤Æ»ÈÍѤ¹¤ë¡£
¡¦£Ì£Ä£Ï¤ÏºÇÂç¾ÃÈñÅÅή¤ÎÌ󣸣°¡óÄøÅÙ¤ò¾å¸Â¤È¤·Ç®¤¬¡¢¼«¸ÊȯǮ¤¬£µ£°ÅÙ¤òĶ¤¨¤ë¤Èʬ»¶¤äÊüÇ®¤¹¤ë»ö¤ò¸¡Æ¤¤¹¤ë¡£
¡¦£Ö£ã£ã£á£õ£ø¤Ï¤Ê¤ë¤Ù¤¯£Ì£Ä£Ï¤ò»ÈÍѤ¹¤ë¡£
¡¦£Í£Ç£Ô¡¢£Ð£Ì£ÌÅù¤Î¥¢¥Ê¥í¥°ÅŸ»¤Ïɬ¤º£Ì£Ä£Ï¤ò»ÈÍѤ¹¤ë¡£
¡¦¤Ê¤ë¤Ù¤¯Ä㤤ÅÅ°µ¤ÎÊý¤«¤é½çÈÖ¤ËΩ¤Á¾å¤²¤ë¡£
Åù¤Ç¤¢¤ë¡£
¾¤Ë¤â¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë¤è¤Ã¤Æ¤ÏÍÍ¡¹¤Ê¸¡Æ¤¤ò¹Ô¤¦É¬Íפ¬¤¢¤ë¤È»×¤¦¡£

ÅŸ»¤Î¸¡Æ¤¤Ï¿ÅŸ»¡¢ÄãÅÅ°µ¤Îº£¤Ï¤È¤Æ¤â½ÅÍפʹàÌܤǡ¢ÅŸ»¤¬ÉÔ°ÂÄê¤À¤È¥¯¥í¥Ã¥¯¤ä£Ã£è£é£ð£Ó£ã£ï£ð£å¤µ¤¨¤â¿®ÍѤǤ­¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¡¢²¿¤â¥Ç¥Ð¥Ã¥°½ÐÍè¤Ê¤¤¤Þ¤Þ²þÈǤʤó¤Æ»ö¤â¤¢¤êÆÀ¤ë¡£



Åê¹Æ»þ¹ï(11:37)¨¢¥³¥á¥ó¥È(0)¨¢Xilinx¥Ä¡¼¥ë 

2007ǯ07·î13Æü

ModelSim TIPS ¡Ö£Õ£ô£é£ì¥Ñ¥Ã¥±¡¼¥¸¡Ê¥Õ¥¡¥ó¥¯¥·¥ç¥ó»ÈÍÑÎã¡Ë¡×

º£Å٤ϡ¢£Í£ï£ä£å£ì£Ó£é£íɸ½à£Õ£ô£é£ì¥Ñ¥Ã¥±¡¼¥¸¤Î¥Õ¥¡¥ó¥¯¥·¥ç¥ó»ÈÍÑÎã¤ò½ñ¤¤¤Æ¤ß¤¿¡£
¥½¡¼¥¹¥³¡¼¥É¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤ë¡£


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

library modelsim_lib;
use modelsim_lib.util.all;

library c;
use c.stdio_h.all;

entity mti_func_test is
end mti_func_test;


architecture behavior of mti_func_test is
begin

    process
        variable    resolution      : real;
        variable    alignment_time  : time;
        variable    current_time    : real;
        variable    wait_time       : real;
    begin
        -- ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Î¼èÆÀ
        resolution := get_resolution;
        printf( "Resolution    = %f\n", resolution );

        -- Ⱦü¤Ê¥¦¥¨¥¤¥È
        wait for 12345678 fs;

        -- Ⱦü¤Ê¥¦¥¨¥¤¥È¤ò¥¢¥é¥¤¥á¥ó¥È
        wait_time := to_real(12345678 fs);
        -- ¸½¥·¥ß¥å¥ì¡¼¥·¥ç¥ó»þ´Ö¤Î¼èÆÀ
        current_time := to_real(now);

        printf( "Current Time  = %f\n", current_time );
        printf( "Wait Time     = %f\n", wait_time );

        -- Ⱦü¤Ê¥¦¥¨¥¤¥È¤ò¥¢¥é¥¤¥ó¥á¥ó¥È
        alignment_time := to_time(12345.678);
        wait for alignment_time;

        -- ¸½¥·¥ß¥å¥ì¡¼¥·¥ç¥ó»þ´Ö¤Î¼èÆÀ
        current_time := to_real(now);

        printf( "Current Time  = %f\n", current_time );

        wait;
    end process;

end behavior;


¤³¤ì¤ò£Í£ï£ä£å£ì£Ó£é£í¤Ç¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤¹¤ë¤È£Ô£ò£á£î£ó£ã£ò£é£ð£ô¥¦¥£¥ó¥É¥¦¤Ë¼¡¤Î¤è¤¦¤Ëɽ¼¨¤µ¤ì¤ë¡£

¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬£±£î£ó¤Î¾ì¹ç


# Resolution    = 1.000000e-009
# Current Time  = 1.200000e+001
# Wait Time     = 1.200000e+001
# Current Time  = 1.235800e+004

¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬£±£ð£ó¤Î¾ì¹ç


# Resolution    = 1.000000e-012
# Current Time  = 1.234600e+004
# Wait Time     = 1.234600e+004
# Current Time  = 2.469200e+004

¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬£±£æ£ó¤Î¾ì¹ç


# Resolution    = 1.000000e-015
# Current Time  = 1.234568e+007
# Wait Time     = 1.234568e+007
# Current Time  = 1.235802e+007

£²²óÌܤΡÖCurrent Time¡×¤Ï¡Öalignment_time := to_time(12345.678);¡×¤Îñ°Ì¤¬¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¤è¤Ã¤ÆÊѲ½¤¹¤ë¤¿¤á¡¢¤³¤Î¤è¤¦¤Ê·ë²Ì¤Ë¤Ê¤ë¡£

2007ǯ07·î12Æü

ModelSim TIPS ¡Ö£Õ£ô£é£ì¥Ñ¥Ã¥±¡¼¥¸¡Ê¥Õ¥¡¥ó¥¯¥·¥ç¥ó²òÀâ¡Ë¡×

£Í£ï£ä£å£ì£Ó£é£í¤Ë¤Ïɸ½à¤Ç£Õ£ô£é£ì¥Ñ¥Ã¥±¡¼¥¸¤¬Æþ¤Ã¤Æ¤¤¤ë¡£
¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ï£¶¼ïÎà¤Î¥×¥í¥·¡¼¥¸¥ã¤È£³¼ïÎà¤Î¥Õ¥¡¥ó¥¯¥·¥ç¥ó¤¬´Þ¤Þ¤ì¤Æ¤ª¤ê°Ê²¼¤Î¥é¥¤¥Ö¥é¥êÀë¸À¤Ç»ÈÍѤ¹¤ë»ö¤¬½ÐÍè¤ë¡£¡Ê£Í£ï£ä£å£ì£Ó£é£í¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤Ã¤Æ¤ÏÆþ¤Ã¤Æ¤¤¤Ê¤¤Êª¤â¤¢¤ë¡Ë


--£Í£ï£ä£å£ì£Ó£é£í¤Î£Õ£ô£é£ì¥Ñ¥Ã¥±¡¼¥¸
library modelsim_lib;
use modelsim_lib.util.all;

¥Õ¥¡¥ó¥¯¥·¥ç¥ó¤Î»ÈÍÑÊýË¡
¡¦get_resolution
¡¡ÍÑÅÓ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤ò¼èÆÀ¤¹¤ë¡£
¡¡°ú¿ô¡§¤Ê¤·
¡¡Ìá¤ê¡§
        ·¿¡§real
        ÀâÌÀ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó
¡¡Î㡧
        variable resolution : real;
        resolution := get_resolution;
        ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬¡Ö1ps¡×¤Î¾ì¹ç¡Ö1e-12¡×¤¬Ìá¤ë¡£

¡¦to_real
¡¡ÍÑÅÓ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿¼Â¿ôÃͤò¼èÆÀ¤¹¤ë¡£
¡¡°ú¿ô¡§
        ̾Á°¡§timeval
        ·¿¡§time
        ÀâÌÀ¡§¥¢¥é¥¤¥ó¥á¥ó¥È¤·¤¿¤¤»þ´ÖÃÍ
¡¡Ìá¤ê¡§
        ¥¿¥¤¥×¡§real
        ÀâÌÀ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿¼Â¿ôÃÍ
¡¡Î㡧
        variable alignment_real : real;
        alignment_real := to_real(123.45 ns);
        ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬¡Ö1ps¡×¤Î¾ì¹ç¡Ö123450¡×¤¬Ìá¤ë¡£

¡¦to_time
¡¡ÍÑÅÓ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿»þ´ÖÃͤò¼èÆÀ¤¹¤ë¡£
¡¡°ú¿ô¡§
        ̾Á°¡§realval
        ·¿¡§real
        ÀâÌÀ¡§¥¢¥é¥¤¥ó¥á¥ó¥È¤·¤¿¤¤¼Â¿ôÃÍ
¡¡Ìá¤ê¡§
        ¥¿¥¤¥×¡§time
        ÀâÌÀ¡§¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿»þ´ÖÃÍ
¡¡Î㡧
        variable alignment_time : time;
        alignment_time := to_time(123.45);
        ¥·¥ß¥å¥ì¡¼¥·¥ç¥ó¤Î¥ì¥¾¥ê¥å¡¼¥·¥ç¥ó¤¬¡Ö1ps¡×¤Î¾ì¹ç¡Ö123ps¡×¤¬Ìá¤ë¡£

º£²ó¤Ï¥Õ¥¡¥ó¥¯¥·¥ç¥ó¤Î»ÈÍÑÊýË¡¤Î¤ß¤Ç¥×¥í¥·¡¼¥¸¥ã¤Ï¤¤¤º¤ì½ñ¤³¤¦¤È»×¤¦¡£



ºÇ¿·¥³¥á¥ó¥È
¥«¥Æ¥´¥êÊÌɽ¼¨
·îÊÌɽ¼¨