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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sim/] [uart_rx_pkg.vhd] - Blame information for rev 61

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 zero_gravi
library vunit_lib;
2
context vunit_lib.vunit_context;
3
context vunit_lib.com_context;
4
use vunit_lib.sync_pkg.all;
5
 
6
package uart_rx_pkg is
7
  constant check_uart_msg : msg_type_t := new_msg_type("check_uart");
8
 
9
  type uart_rx_t is record
10
    p_baud_val : real;
11
    p_logger : logger_t;
12
    p_actor : actor_t;
13
  end record;
14
 
15
  impure function new_uart_rx(
16
    baud_val : real;
17
    logger : logger_t := null_logger;
18
    actor : actor_t := null_actor) return uart_rx_t;
19
 
20
  function as_sync(handle : uart_rx_t) return sync_handle_t;
21
 
22
  procedure check_uart(
23
    signal net : inout network_t;
24
    constant handle : in uart_rx_t;
25
    constant data : in string);
26
end package uart_rx_pkg;
27
 
28
package body uart_rx_pkg is
29
  constant uart_rx_logger  : logger_t  := get_logger("neorv32_lib:uart_rx_pkg");
30
 
31
  impure function new_uart_rx(
32
    baud_val : real;
33
    logger : logger_t := null_logger;
34
    actor : actor_t := null_actor) return uart_rx_t is
35
    variable result : uart_rx_t;
36
  begin
37
    result.p_baud_val := baud_val;
38
    result.p_logger := logger when logger /= null_logger else uart_rx_logger;
39
    result.p_actor := actor when actor /= null_actor else new_actor;
40
 
41
    return result;
42
  end;
43
 
44
  function as_sync(handle : uart_rx_t) return sync_handle_t is
45
  begin
46
    return handle.p_actor;
47
  end;
48
 
49
  procedure check_uart(
50
    signal net : inout network_t;
51
    constant handle : in uart_rx_t;
52
    constant data : in string) is
53
    variable msg : msg_t;
54
  begin
55
    msg := new_msg(check_uart_msg);
56
    push(msg, data);
57
    send(net, handle.p_actor, msg);
58
  end;
59
 
60
end package body uart_rx_pkg;

powered by: WebSVN 2.1.0

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