library ieee;
use ieee.std_logic_1164.all;
entity source is
generic(
type data_type;
procedure read(l: inout std.textio.line; value: out data_type; good: out boolean);
stm_file: string
);
port(
clk: in std_logic;
resetn: in std_logic;
data: out data_type;
valid: out std_logic;
ready: in std_logic;
valid_i: in std_logic := '1'
);
end entity source;
architecture behav of source is
file stimuli: std.textio.text open read_mode is stm_file;
type packet_t is record
data: data_type;
valid: std_logic;
end record;
impure function next_packet(file stimuli: std.textio.text) return packet_t is
variable stimuli_line: std.textio.line;
variable packet: packet_t;
variable good: boolean := false;
begin
while not std.textio.endfile(stimuli) and not good loop
std.textio.readline(stimuli, stimuli_line);
read(stimuli_line, packet.data, good);
end loop;
packet.valid := '1' when good else '0';
return packet;
end function;
signal packet: packet_t;
signal init: std_logic;
begin
process(clk) is
begin
if rising_edge(clk) then
if resetn = '0' then
packet.valid <= '0';
init <= '0';
else
if init = '0' or (packet.valid = '1' and valid_i = '1' and ready = '1') then
packet <= next_packet(stimuli);
init <= '1';
end if;
end if;
end if;
end process;
data <= packet.data;
valid <= packet.valid and valid_i;
end architecture behav;
lass='active' href='/cgit/avr/qmk/firmware/tree/quantum/process_keycode/process_grave_esc.h?id=76b21a4b90a490c69175bef2dffc6eb6759ac26d'>treecommitdiffstats
blob: bbf448376314dfe5205f75631cd775da9b4efa91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* Copyright 2020
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
bool process_grave_esc(uint16_t keycode, keyrecord_t *record);
|