library ieee; use ieee.std_logic_1164.all; entity clkgen is generic (period : time := 10 ns); port (signal clk : out std_logic := '0'); end clkgen; architecture behav of clkgen is begin process begin clk <= not clk; wait for period / 2; end process; end behav; entity hello is end hello; architecture behav of hello is signal clk : std_logic; signal rst_n : std_logic; signal din, dout, dout2 : std_logic_vector (7 downto 0); component clkgen is generic (period : time := 10 ns); port (signal clk : out std_logic); end component; begin cclk : clkgen generic map (period => 20 ns) port map (clk => clk); rst_n <= '0' after 0 ns, '1' after 4 ns; p: process (clk) begin if rising_edge (clk) then if rst_n then q <= (others => '0'); else q <= d; end if; end if; end process p; process variable v : natural := 0; begin wait until rst_n = '1'; wait until clk = '0'; report "start of tb" severity note; for i in 0 to 10 loop case i is when 0 | 3 => for i in din'range loop din(i) <= '0'; end loop; when 1 => din <= b"00110011"; when 2 => v := 0; while v < 7 loop din (v) <= '1'; v := v + 1; end loop; when 4 to 5 | 8 => din <= x"a5"; when others => null; end case; end loop; wait until clk = '0'; end process; assert false report "Hello world" severity note; \nd behav;"party/python-console/Utils.h?id=d5ec421d988b92d1f610d6a031381a999b3f901c'>treecommitdiffstats
path: root/3rdparty/python-console/Utils.h
blob: bbd11a1a3704456c7c56f994bfd8f6388ce18d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef PYTHON_CONSOLE_UTILS_H
#define PYTHON_CONSOLE_UTILS_H
#include <string>
#include <vector>

/**
InputIterator has value type of std::string.
*/
template < class InputIterator >
std::string LongestCommonPrefix( InputIterator begin, InputIterator end )
{
    if ( begin == end )
        return "";

    const std::string& str0 = *begin;
    if ( ! str0.size() )
        return "";

    int endIndex = str0.size() - 1;
    InputIterator it = begin; ++it;
    for (; it != end; ++it)
    {
        const std::string& str = *it;
        for (int j = 0; j <= endIndex; ++j)
        {
            if (j >= (int)str.size() || str[j] != str0[j])
                endIndex = j - 1;
        }
    }
    return (endIndex > 0)? str0.substr(0, endIndex + 1) : "";
}

#endif // PYTHON_CONSOLE_UTILS_H