@@ -17,38 +17,36 @@ use work.i2c_ctrl_vc_pkg.all;
17
17
18
18
package i2c_pca9506ish_sim_pkg is
19
19
20
- constant i2c_tgt_addr: std_logic_vector (6 downto 0 ) := 7x"20" ;
21
-
22
20
constant i2c_ctrl_vc : i2c_ctrl_vc_t := new_i2c_ctrl_vc(" i2c_ctrl_vc" );
23
21
24
22
-- Some helper functions for writing test benches.
25
23
-- want to be able to read/write arbitrary registers
26
24
-- want to be able to read/write categories of registers (wrapping)
27
25
procedure single_write_pca9506_reg (
28
26
signal net : inout network_t;
27
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
29
28
constant register_addr : in integer range 0 to 16#27# ;
30
29
constant write_data: in std_logic_vector (7 downto 0 );
31
30
variable did_ack: inout boolean ;
32
- constant auto_inc: in boolean := true ;
33
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
31
+ constant auto_inc: in boolean := true
34
32
);
35
33
procedure write_pca9506_reg (
36
34
signal net : inout network_t;
35
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
37
36
constant starting_reg : in integer range 0 to 16#27# ;
38
37
constant byte_queue: in queue_t;
39
38
constant ack_queue: in queue_t;
40
- constant auto_inc: in boolean := true ;
41
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
39
+ constant auto_inc: in boolean := true
42
40
);
43
41
44
42
procedure read_pca9506_reg (
45
43
signal net : inout network_t;
44
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
46
45
constant starting_reg : in integer range 0 to 16#27# ;
47
46
constant num_regs_to_read : in integer ;
48
47
constant response_queue: in queue_t;
49
48
constant ack_queue: in queue_t;
50
- constant auto_inc: in boolean := true ;
51
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
49
+ constant auto_inc: in boolean := true
52
50
);
53
51
54
52
end package ;
@@ -57,17 +55,17 @@ package body i2c_pca9506ish_sim_pkg is
57
55
58
56
procedure single_write_pca9506_reg (
59
57
signal net : inout network_t;
58
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
60
59
constant register_addr : in integer range 0 to 16#27# ;
61
60
constant write_data: in std_logic_vector (7 downto 0 );
62
61
variable did_ack: inout boolean ;
63
- constant auto_inc: in boolean := true ;
64
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
62
+ constant auto_inc: in boolean := true
65
63
) is
66
64
constant tx_queue : queue_t := new_queue;
67
65
constant ack_queue: queue_t := new_queue;
68
66
begin
69
67
push_byte(tx_queue, to_integer (write_data));
70
- write_pca9506_reg(net, register_addr, tx_queue, tx_queue, auto_inc, i2c_addr );
68
+ write_pca9506_reg(net, i2c_addr, register_addr, tx_queue, tx_queue, auto_inc);
71
69
did_ack := true ;
72
70
while not is_empty(ack_queue) loop
73
71
if pop_byte(ack_queue) = 0 then
@@ -79,11 +77,11 @@ package body i2c_pca9506ish_sim_pkg is
79
77
80
78
procedure write_pca9506_reg (
81
79
signal net : inout network_t;
80
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
82
81
constant starting_reg : in integer range 0 to 16#27# ;
83
82
constant byte_queue: in queue_t;
84
83
constant ack_queue: in queue_t;
85
- constant auto_inc: in boolean := true ;
86
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
84
+ constant auto_inc: in boolean := true
87
85
) is
88
86
variable cmd_reg : std_logic_vector (7 downto 0 );
89
87
constant tx_queue : queue_t := new_queue;
@@ -102,12 +100,12 @@ package body i2c_pca9506ish_sim_pkg is
102
100
103
101
procedure read_pca9506_reg (
104
102
signal net : inout network_t;
103
+ constant i2c_addr : in std_logic_vector (6 downto 0 );
105
104
constant starting_reg : in integer range 0 to 16#27# ;
106
105
constant num_regs_to_read : in integer ;
107
106
constant response_queue: in queue_t;
108
107
constant ack_queue: in queue_t;
109
- constant auto_inc: in boolean := true ;
110
- constant i2c_addr : in std_logic_vector (6 downto 0 ) := i2c_tgt_addr
108
+ constant auto_inc: in boolean := true
111
109
) is
112
110
variable cmd_reg : std_logic_vector (7 downto 0 );
113
111
constant tx_queue : queue_t := new_queue;
0 commit comments