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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [gleichmann/] [sim/] [uart_ext.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
--------------------------------------------------------------------------------
2
--  Project:         LEON-ARC
3
--  Entity:          uart_ext
4
--  Architecture(s): behav
5
--  Author:          tame@msc-ge.com
6
--  Company:         Gleichmann Electronics
7
--
8
--  Description:
9
--    This file contains a simple module that is connected to the 4 UART
10
--    signals CTS, RX, RTS and TX. It loops the signals RTS and TX back to the
11
--    outputs CTS and RX after a predefined time.
12
--    If enabled, the logger prints the current value of the 4 pins mentioned
13
--    above into a log file whenever they change.
14
--
15
--------------------------------------------------------------------------------
16
 
17
 
18
library ieee;
19
use ieee.std_logic_1164.all;
20
use std.textio.all;
21
 
22
library work;
23
use work.txt_util.all;
24
 
25
 
26
entity uart_ext is
27
  generic (
28
    logfile_name : string := "logfile_uart";
29
    t_delay      : time   := 5 ns);
30
  port (
31
    resetn    : in  std_logic;
32
    -- logging enable signal
33
    log_en    : in  std_logic := '1';
34
    -- current cycle number
35
    cycle_num : in  integer;
36
    cts       : out std_logic;
37
    rxd       : out std_logic;
38
    txd       : in  std_logic;
39
    rts       : in  std_logic);
40
end entity;
41
 
42
 
43
architecture behav of uart_ext is
44
  file logfile              : text open write_mode is logfile_name;
45
  shared variable logline   : line;
46
  shared variable logstring : string(1 to 80);
47
begin
48
 
49
  log_start : process is
50
  begin
51
    if log_en = '1' then
52
      print(logfile, "#");
53
      print(logfile, "# CYCLE_NUMBER CTS RX RTS TX");
54
      print(logfile, "#");
55
    end if;
56
    wait;
57
  end process;
58
 
59
  -- note: cycle number shall not be on sensitivity list
60
  log_loop : postponed process (log_en, rts, txd) is
61
    variable rxd_int : std_logic;
62
    variable cts_int : std_logic;
63
  begin
64
    rxd_int := txd;
65
    cts_int := rts;
66
    if (log_en = '1') and (cycle_num >= 0) then
67
      print(logfile,
68
            str(cycle_num) & " " &
69
            str(cts_int) & " " &
70
            str(rxd_int) & " " &
71
            str(rts) & " " &
72
            str(txd));
73
    end if;
74
    rxd <= rxd_int after t_delay;
75
    cts <= cts_int after t_delay;
76
  end process;
77
 
78
end architecture;

powered by: WebSVN 2.1.0

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