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

Subversion Repositories gpib_controller

[/] [gpib_controller/] [trunk/] [vhdl/] [src/] [wrapper/] [WriterControlReg0.vhd] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Andrewski
--------------------------------------------------------------------------------
2
-- Entity: WriterControlReg0
3
-- Date:2011-11-10  
4
-- Author: Administrator     
5
--
6
-- Description ${cursor}
7
--------------------------------------------------------------------------------
8
library ieee;
9
use ieee.std_logic_1164.all;
10
use ieee.std_logic_unsigned.all;
11
 
12
use work.utilPkg.all;
13
use work.helperComponents.all;
14
 
15
entity WriterControlReg0 is
16
        port (
17
                clk : in std_logic;
18
                reset : in std_logic;
19
                strobe : in std_logic;
20
                data_in : in std_logic_vector (15 downto 0);
21
                data_out : out std_logic_vector (15 downto 0);
22
                ------------------- gpib -------------------------
23
                -- buffer consumed
24
                buf_interrupt : in std_logic;
25
                -- data avilable - at least one byte in buffer
26
                data_available : out std_logic;
27
                -- indicates end of stream
28
                end_of_stream : out std_logic;
29
                -- resets buffer
30
                reset_buffer : out std_logic;
31
                -- secondary address of data
32
                dataSecAddr : out std_logic_vector (4 downto 0);
33
                -- serial poll status byte
34
                status_byte : out std_logic_vector (6 downto 0)
35
        );
36
end WriterControlReg0;
37
 
38
architecture arch of WriterControlReg0 is
39
 
40
        signal i_data_available : std_logic;
41
        signal i_end_of_stream : std_logic;
42
        signal i_reset_buffer : std_logic;
43
        signal i_dataSecAddr : std_logic_vector (4 downto 0);
44
        signal i_status_byte : std_logic_vector (6 downto 0);
45
 
46
        signal t_in, t_out : std_logic;
47
 
48
begin
49
 
50
        data_out(0) <= buf_interrupt;
51
        data_out(1) <= i_data_available;
52
        data_out(2) <= i_end_of_stream;
53
        data_out(3) <= i_reset_buffer;
54
        data_out(8 downto 4) <= i_dataSecAddr;
55
        data_out(15 downto 9) <= i_status_byte;
56
 
57
        data_available <= i_data_available;
58
        end_of_stream <= i_end_of_stream;
59
        reset_buffer <= i_reset_buffer;
60
        dataSecAddr <= i_dataSecAddr;
61
        status_byte <= i_status_byte;
62
 
63
        process (reset, strobe) begin
64
                if reset = '1' then
65
                        t_in <= '0';
66
                        i_data_available <= '1';
67
                elsif rising_edge(strobe) then
68
 
69
                        i_data_available <= data_in(1);
70
                        i_end_of_stream <= data_in(2);
71
 
72
                        if data_in(3) = '1' then
73
                                t_in <= not t_out;
74
                        end if;
75
 
76
                        i_dataSecAddr <= data_in(8 downto 4);
77
                        i_status_byte <= data_in(15 downto 9);
78
 
79
                end if;
80
        end process;
81
 
82
        spg: SinglePulseGenerator generic map (WIDTH => 3) port map(
83
                reset => reset, clk => clk,
84
                t_in => t_in, t_out => t_out,
85
                pulse => i_reset_buffer
86
        );
87
 
88
end arch;
89
 

powered by: WebSVN 2.1.0

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