OpenCores
URL https://opencores.org/ocsvn/keyboardcontroller/keyboardcontroller/trunk

Subversion Repositories keyboardcontroller

[/] [keyboardcontroller/] [trunk/] [Strober.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wouterw
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
use work.Constants.all;
5
 
6
entity Strober is
7
    port (reset, clk : in  std_logic;
8
       strobe : in std_logic;
9
       sample : in std_logic;
10
       env_col : in col;
11
       env_row : out row;
12
       sample_col : out col; --rows and cols to be analysed
13
       sample_row_number : out row_number
14
       );
15
 
16
end Strober;
17
 
18
architecture Strober_arc of Strober is
19
 
20
function decode_row(inp: row_number) return row is
21
variable rowstrobe : row;
22
begin
23
        case inp is
24
        when 11 => rowstrobe := "011111111111";
25
        when 10 => rowstrobe := "101111111111";
26
        when 9 => rowstrobe :=  "110111111111";
27
        when 8 => rowstrobe :=  "111011111111";
28
        when 7 => rowstrobe :=  "111101111111";
29
        when 6 => rowstrobe :=  "111110111111";
30
        when 5 => rowstrobe :=  "111111011111";
31
        when 4 => rowstrobe :=  "111111101111";
32
        when 3 => rowstrobe :=  "111111110111";
33
        when 2 => rowstrobe :=  "111111111011";
34
        when 1 => rowstrobe :=  "111111111101";
35
        when 0 => rowstrobe :=  "111111111110";
36
        when others => rowstrobe := "111111111111";
37
        end case;
38
        return rowstrobe;
39
end decode_row;
40
 
41
begin
42
 
43
   strober: process
44
   variable row_counter : integer;
45
   begin
46
       wait until rising_edge(clk);
47
       if (reset = '1') then
48
           env_row <= "111111111111";
49
           row_counter := 0;
50
       elsif (strobe = '1') then
51
           if (row_counter < number_of_cols-1) then
52
                row_counter := row_counter + 1;
53
           elsif(row_counter = number_of_cols-1)then
54
                row_counter := 0;
55
           end if;
56
           env_row <= decode_row(row_counter);
57
       elsif (sample ='1') then --first sample
58
           sample_row_number <= row_counter;
59
           sample_col <= not env_col;
60
       end if;
61
   end process;
62
 
63
end strober_arc;
64
 
65
 
66
 
67
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.