File tree 2 files changed +8
-16
lines changed
2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Implementation of Inter-IC (I2C) bus master and slave, covering almost all edge
17
17
- [x] SDA
18
18
- [x] Transmit
19
19
- [x] Receive
20
- - [x] Arbitration (multi-master)
20
+ - [x] Arbitration (multi-master) (untested)
21
21
- [x] Basic Implementation
22
22
- [x] Detect other masters triggering start before this master
23
23
- [ ] Hotloading (not from i2c spec)
@@ -26,7 +26,7 @@ Implementation of Inter-IC (I2C) bus master and slave, covering almost all edge
26
26
- listen for WAIT_TIME_END to see if the clock is driven LOW
27
27
- if no: bus is free
28
28
- if yes: keep listening until a STOP or START
29
- - [x] Other masters
29
+ - [x] Other masters (untested)
30
30
- [x] erroneous starts detected w/ start_err
31
31
- [x] Port map
32
32
- Slave
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ logic start_by_another_master = 1'b0;
92
92
always @ (sda === 1'bz or sda === 1'b0 )
93
93
begin
94
94
if (scl === 1'bz )
95
+ `else
96
+ always @ (posedge sda or negedge sda)
97
+ begin
98
+ if (scl)
99
+ `endif
95
100
begin
96
101
busy <= sda === 1'b0 ;
97
102
if (sda === 1'b0 )
@@ -100,23 +105,10 @@ begin
100
105
$display (" Master becomes free @ %d %d " , counter, transaction_progress);
101
106
// See Note 4 in Section 3.1.10
102
107
// Should only trigger if a start occurs while this master was in the middle of something.
103
- if (busy && sda == 1'b0 && transaction_progress != 4'd0 && transaction_progress != 4'd11 && MULTI_MASTER )
104
- start_by_another_master <= 1'd1 ;
105
- end
106
- end
107
- `else
108
- always @ (posedge sda or negedge sda)
109
- begin
110
- if (scl)
111
- begin
112
- busy <= ! sda;
113
- // See Note 4 in Section 3.1.10
114
- // Should only trigger if a start occurs while this master was in the middle of something.
115
- if (busy && ! sda && transaction_progress != 4'd0 && transaction_progress != 4'd11 && MULTI_MASTER )
108
+ if (busy && ! sda && ! (transfer_start && (transaction_progress == 4'd1 || transaction_progress == 4'd11 )) && MULTI_MASTER )
116
109
start_by_another_master <= 1'd1 ;
117
110
end
118
111
end
119
- `endif
120
112
121
113
// Conforms to Table 10 minimum setup/hold/bus free times.
122
114
localparam TLOW_MIN = MODE == 0 ? 4 .7 : MODE == 1 ? 1 .3 : MODE == 2 ? 0 .5 : 0 ; // in microseconds
You can’t perform that action at this time.
0 commit comments