-
Notifications
You must be signed in to change notification settings - Fork 35
/
mdl_sdio.v
688 lines (634 loc) · 16.6 KB
/
mdl_sdio.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
////////////////////////////////////////////////////////////////////////////////
//
// Filename: bench/verilog/mdl_sdio.v
// {{{
// Project: SD-Card controller
//
// Purpose:
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
////////////////////////////////////////////////////////////////////////////////
// }}}
// Copyright (C) 2016-2024, Gisselquist Technology, LLC
// {{{
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
// target there if the PDF file isn't present.) If not, see
// <http://www.gnu.org/licenses/> for a copy.
// }}}
// License: GPL, v3, as defined and found on www.gnu.org,
// {{{
// http://www.gnu.org/licenses/gpl.html
//
////////////////////////////////////////////////////////////////////////////////
//
`timescale 1ns/1ps
// }}}
module mdl_sdio #(
parameter [0:0] OPT_DUAL_VOLTAGE = 1'b0,
parameter [0:0] OPT_HIGH_CAPACITY = 1'b0,
parameter LGMEMSZ = 16, // Log_2(Mem size in bytes)
localparam MEMSZ = (1<<LGMEMSZ)
) (
// {{{
input wire sd_clk,
inout wire sd_cmd,
inout wire [3:0] sd_dat
// , output wire sd_ds
// }}}
);
// Local declarations
// {{{
// Maximum allowable busy time is 250ms.
// localparam realtime WRITE_TIME = 250_000_000.0;
// A 250ms timeout is unreasonable for simulations, however, so we'll
// drop it to 1250ns or so. This should at least force a busy of a
// single clock cycle in 1MHz mode.
localparam realtime WRITE_TIME = 1250.0;
// I have no idea what sort of read time is appropriate. Therefore,
// the following is nothing more than a guess.
localparam realtime READ_TIME = 400.0;
// REPLY_DELAY is the time from recognizing a command until a reply
// is requested. This time should come from the SDIO spec, but my
// copy is the simplified spec that doesn't contain this value. Too
// short, and the SERDES tristate can't clear fast enough.
localparam realtime REPLY_DELAY = 7.0;
reg cfg_ddr;
reg [1:0] cfg_width;
wire [3:0] ign_dat;
wire cmd_valid, cmd_ds, cmd_crc_err;
wire [5:0] cmd;
wire [31:0] cmd_arg;
reg reply_valid, reply_type, reply_crc;
wire reply_busy;
reg [5:0] reply;
reg [119:0] reply_data;
reg [119:0] CID;
reg [31:0] ocr;
reg power_up_busy, cmd_alt, cmd8_sent, card_reset,
host_supports_hcs, r_1p8v_request, r_1p8v;
reg [15:0] RCA;
reg [31:0] R1;
reg drive_cmd, card_selected;
wire cmd_collision;
reg read_en, pending_read, multi_block,
stop_transmission;
wire rx_valid, rx_last, rx_good, rx_err;
wire [31:0] rx_data;
integer read_ik;
reg write_en, tx_valid, tx_last, pending_write;
reg [31:0] tx_data;
wire tx_ready, tx_ds;
reg [6:0] tx_addr;
reg [31:0] mem_buf [0:127];
reg [6:0] rx_addr;
reg [LGMEMSZ-1:0] read_posn;
integer write_ik;
reg card_busy, internal_card_busy;
// }}}
////////////////////////////////////////////////////////////////////////
//
// Command wire handler
// {{{
mdl_sdcmd
tb_sdcmd (
// {{{
.rst_n(1'b1), // Not used in SDIO mode
.sd_clk(sd_clk), .sd_cmd(sd_cmd),
.sd_ds(cmd_ds),
//
.o_cmd_valid(cmd_valid), .o_cmd(cmd), .o_arg(cmd_arg),
.o_crc_err(cmd_crc_err),
//
.i_valid(reply_valid), .i_type(reply_type),
.o_busy(reply_busy), .i_reply(reply),
.i_arg(reply_data), .i_use_crc(reply_crc),
.i_drive(drive_cmd), .o_collision(cmd_collision)
// }}}
);
// }}}
////////////////////////////////////////////////////////////////////////
//
// Read data from the user (write operation)
// {{{
mdl_sdrx
tb_sdrx (
// {{{
.rst_n(1'b1), // Not used in SDIO mode
.sd_clk(sd_clk), .sd_dat({ ign_dat, sd_dat }),
//
.i_rx_en(read_en), .i_width(cfg_width), .i_ddr(cfg_ddr),
.i_len(16'd512),
//
.o_valid(rx_valid), .o_data(rx_data), .o_last(rx_last),
.o_good(rx_good), .o_err(rx_err)
// }}}
);
// }}}
////////////////////////////////////////////////////////////////////////
//
// Read from the card, send to the user (read operation)
// {{{
reg r_crcack, r_crcnak;
mdl_sdtx
tb_sdtx (
// {{{
.rst_n(1'b1), // Not used in SDIO mode
.sd_clk(sd_clk), .sd_dat({ ign_dat, sd_dat }),
.sd_ds(tx_ds),
//
.i_en(write_en), .i_width(cfg_width), .i_ddr(cfg_ddr),
.i_ppull(1'b0),
//
.i_crcack(r_crcack), .i_crcnak(r_crcnak),
//
.i_valid(tx_valid), .o_ready(tx_ready),
.i_data(tx_data), .i_last(tx_last)
// }}}
);
// }}}
////////////////////////////////////////////////////////////////////////
//
// SDIO MEM
// {{{
reg [31:0] mem [0:(MEMSZ/4)-1];
integer mem_fileid, mem_code;
/*
initial if (MEMFILE != 0)
begin
mem_fileid = $fopen(MEMFILE, "rb");
mem_code = $fread(mem, mem_fileid);
$fclose(mem_fileid);
end
*/
task mem_blkwrite(input [31:0] posn);
// {{{
integer write_ik;
begin
for(write_ik=0; write_ik<512/4; write_ik=write_ik+1)
mem[write_ik+posn] = mem_buf[write_ik];
end endtask
// }}}
task mem_blkread(input [31:0] posn);
// {{{
integer read_ik;
begin
for(read_ik=0; read_ik<512/4; read_ik=read_ik+1)
mem_buf[read_ik] = mem[read_ik+posn];
end endtask
// }}}
/*
generate if (MEMFILE == 0)
begin : NO_MEMFILE
end else begin : USE_MEMFILE
integer mem_fileid;
initial mem_fileid = $fope(MEMFILE, "rb+");
task mem_blkwrite(input [31:0] posn);
// {{{
integer read_ik;
reg [31:0] word;
begin
$fseek(mem_fileid, posn, 1);
for(read_ik=0; read_ik<512/4; read_ik=read_ik+1)
begin
word[31:24] = $fgetc(mem_fileid);
word[23:16] = $fgetc(mem_fileid);
word[15: 8] = $fgetc(mem_fileid);
word[ 7: 0] = $fgetc(mem_fileid);
mem_buf[read_ik] = word;
end
end endtask
// }}}
task mem_blkread(input [31:0] posn);
// {{{
integer read_ik;
reg [31:0] word;
begin
$fseek(mem_fileid, posn, 1);
for(read_ik=0; read_ik<512/4; read_ik=read_ik+1)
begin
word[31:24] = $fgetc(mem_fileid);
word[23:16] = $fgetc(mem_fileid);
word[15: 8] = $fgetc(mem_fileid);
word[ 7: 0] = $fgetc(mem_fileid);
mem_buf[read_ik] = word;
end
end endtask
// }}}
end endgenerate
*/
// }}}
////////////////////////////////////////////////////////////////////////
//
// SDIO FSM
// {{{
initial ocr = 32'h80ff_8000;
initial cmd_alt = 1'b0;
initial power_up_busy = 1'b1;
initial cmd8_sent = 1'b0;
initial host_supports_hcs = OPT_HIGH_CAPACITY;
initial r_1p8v_request = 1'b0;
initial r_1p8v = 1'b0;
initial RCA = 16'h0;
initial R1 = 32'h0;
initial drive_cmd = 1'b0;
initial card_selected = 1'b1;
initial cfg_width = 2'b0; // 1b width
initial cfg_ddr = 1'b0; // SDR
initial read_en = 1'b0;
initial stop_transmission = 1'b0;
initial multi_block = 1'b0;
initial begin
reply_valid = 1'b0;
reply_type = 1'b0;
reply = 6'h0;
reply_data = {(120){1'b0}};
CID[119:112] = $random; // MFGR ID
CID[111: 96] = "GT"; // OED/ Application ID
CID[ 95: 56] = "SM-MODEL"; // Product name
CID[ 55: 48] = $random; // Product revision
CID[ 47: 16] = $random; // Serial number
CID[ 15: 12] = 4'h0; // Reserved
CID[ 11: 0] = $random; // Manufacturing code
// CRC not included in our version
end
always @(*)
ocr[31] = !power_up_busy;
always @(*)
ocr[30] = cmd8_sent && host_supports_hcs && OPT_HIGH_CAPACITY;
always @(posedge sd_clk)
if (cmd_valid && !cmd_crc_err)
begin
cmd_alt <= 1'b0;
reply_crc <= 1'b1; // All replies get CRCs by default
reply_type <= 1'b0;
card_reset <= 0;
r_1p8v_request <= 1'b0;
casez({ cmd_alt, cmd[5:0] })
// AMDs
{ 1'b1, 6'd6 }: begin
// {{{
if (card_selected)
begin
cfg_width[0] <= (cmd_arg[1:0] == 2'b10);
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd6;
reply_data <= { {(120-32){1'b0}}, R1};
end end
// }}}
{ 1'b1, 6'd41 }: begin
// {{{
// assert(cmd8_sent);
host_supports_hcs <= cmd_arg[30] && host_supports_hcs;
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'b111111;
r_1p8v_request <= (OPT_DUAL_VOLTAGE && cmd_arg[24] && !power_up_busy);
reply_data <= { {(120-32){1'b0}}, ocr[31],
((cmd8_sent && cmd_arg[30]
&& host_supports_hcs)
&& OPT_HIGH_CAPACITY),
ocr[29:25],
(OPT_DUAL_VOLTAGE && cmd_arg[24] && !power_up_busy),
ocr[23:8], 8'h0 };
reply_crc <= 1'b0;
if (0 == (ocr[23:8] & cmd_arg[23:8]))
begin
reply_data[31] <= 1'b0;
power_up_busy <= 1;
end else begin
// 5 command/reply cycles at 100kHz
// power_up_busy <= #(5*2*48*10000) 1'b0;
// or ... 5 command/reply cycles at 1MHz
power_up_busy <= #(5*2*48*1000) 1'b0;
end end
// }}}
{ 1'b?, 6'd0 }: begin // CMD0: Go idle
// {{{
reply_valid <= 1'b0;
// ocr[31] <= power_up_busy;
ocr[7] <= 1'b0;
cmd8_sent <= 1'b0;
card_reset <= 1;
pending_read <= 1'b0;
read_en <= 1'b0;
pending_write <= 1'b0;
write_en <= 1'b0;
RCA <= 16'h0;
drive_cmd <= 1'b0;
card_selected <= 1'b1;
cfg_width <= 2'b0;
end
// }}}
{ 1'b?, 6'd2 }: begin // CMD2: ALL_SEND_CID
// {{{
if (card_selected && !power_up_busy)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply_type <= 1'b1;
reply <= 6'd63;
reply_data <= CID;
drive_cmd <= 1'b0;
end end
// }}}
{ 1'b?, 6'd3 }: begin // CMD3: SEND_RELATIVE_ADDR
// {{{
if (!cmd_collision)
begin
RCA = $random;
while(RCA == 16'h0)
RCA = $random;
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd3;
reply_data <= { {(120-32){1'b0}}, RCA, 16'h0 };
drive_cmd <= 1'b1;
card_selected <= 1'b0;
end end
// }}}
// { 1'b?, 6'd6 }: begin // CMD6: SWITCH_FUNCTION (+/- DDR, etc)
{ 1'b?, 6'd7 }: begin // CMD7: SELECT_DESELECT_CARD
// {{{
card_selected <= (cmd_arg[31:16] == RCA);
reply_valid <= #REPLY_DELAY (cmd_arg[31:16] == RCA);
reply <= 6'd7;
reply_data <= { {(120-32){1'b0}}, R1};
end
// }}}
{ 1'b?, 6'd8 }: begin // CMD8: SEND_IF_COND
// {{{
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd8;
// assert(cmd_arg[31:12]==20'h0);
// assert(cmd_arg[11:8]==4'h1);
reply_data <= { {(120-32){1'b0}}, cmd_arg };
ocr[7] <= 1'b0;
if (!cmd8_sent)
begin
if (OPT_HIGH_CAPACITY)
ocr[30] <= 1'b1;
if (OPT_DUAL_VOLTAGE)
ocr[7] <= 1'b1;
cmd8_sent <= 1'b1;
end end
// }}}
{ 1'b?, 6'd10 }: begin // CMD10: SEND_CID
// {{{
if (cmd_arg[31:16] == RCA)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply_type <= 1'b1;
reply <= 6'd10;
reply_data <= CID;
drive_cmd <= 1'b1;
end end
// }}}
{ 1'b?, 6'd11 }: begin // CMD11: Voltage switch
// {{{
if (r_1p8v_request && OPT_DUAL_VOLTAGE && !r_1p8v && !power_up_busy)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd11;
reply_data <= { {(120-32){1'b0}}, 32'h0 };
cmd_alt <= 1'b1;
end end
// }}}
{ 1'b?, 6'd12 }: begin // CMD12: STOP_TRANSMISSION
// {{{
if (card_selected)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd12;
reply_data <= { {(120-32){1'b0}}, R1 };
stop_transmission <= 1'b1;
multi_block <= 1'b0;
pending_read <= 1'b0;
pending_write <= 1'b0;
write_en <= 1'b0;
end end
// }}}
{ 1'b?, 6'd17 }: begin // CMD19: Read block
// {{{
if (card_selected)
begin
pending_write <= #READ_TIME 1'b1;
multi_block <= 1'b0;
// write_en <= 1'b1;
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd17;
reply_data <= { {(120-32){1'b0}}, R1};
if (host_supports_hcs)
read_posn <= cmd_arg << 7;
else
read_posn <= cmd_arg >> 2;
rx_addr <= 0;
stop_transmission <= 1'b0;
end end
// }}}
{ 1'b?, 6'd18 }: begin // CMD20: Read multiple
// {{{
if (card_selected)
begin
pending_write <= #READ_TIME 1'b1;
multi_block <= 1'b1;
// write_en <= 1'b1;
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd18;
reply_data <= { {(120-32){1'b0}}, R1};
if (host_supports_hcs)
read_posn <= cmd_arg << 7;
else
read_posn <= cmd_arg >> 2;
rx_addr <= 0;
stop_transmission <= 1'b0;
end end
// }}}
{ 1'b?, 6'd24 }: begin // CMD24: Write block
// {{{
if (card_selected)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd24;
reply_data <= { {(120-32){1'b0}}, R1};
pending_read <= 1'b1;
multi_block <= 1'b0;
stop_transmission <= 1'b0;
if (host_supports_hcs)
read_posn <= cmd_arg << 7;
else
read_posn <= cmd_arg >> 2;
rx_addr <= 0;
end end
// }}}
{ 1'b?, 6'd25 }: begin // CMD24: Write multiple
// {{{
if (card_selected)
begin
reply_valid <= #REPLY_DELAY 1'b1;
reply <= 6'd25;
reply_data <= { {(120-32){1'b0}}, R1};
pending_read <= 1'b1;
multi_block <= 1'b1;
stop_transmission <= 1'b0;
if (host_supports_hcs)
read_posn <= cmd_arg << 7;
else
read_posn <= cmd_arg >> 2;
rx_addr <= 0;
end end
// }}}
{ 1'b?, 6'd55 }: begin // CMD55: APP_CMD, ACMD to follow
// {{{
reply_valid <= #REPLY_DELAY card_selected;
reply <= 6'd55;
reply_data <= { {(120-32){1'b0}}, 32'h0120 };
cmd_alt <= 1'b1;
end
// }}}
endcase
end
always @(posedge sd_clk)
if (reply_valid && !reply_busy)
reply_valid <= 1'b0;
always @(posedge sd_clk)
if (stop_transmission && !cmd_valid)
begin
pending_read <= 0;
read_en <= 0;
end else if (!reply_busy && pending_read)
begin
if (!internal_card_busy)
begin
pending_read <= 0;
read_en <= !stop_transmission && (cmd[5:0] == 6'd24
|| cmd[5:0] == 6'd25);
end
end else if (read_en && (rx_good || rx_err))
begin
read_en <= 0;
if (multi_block && !stop_transmission)
begin
internal_card_busy <= 1'b1;
pending_read <= 1'b1;
internal_card_busy <= #READ_TIME 1'b0;
end
end
initial { r_crcack, r_crcnak } = 2'b0;
always @(posedge sd_clk)
begin
r_crcack <= read_en && rx_good;
r_crcnak <= read_en && rx_err;
end
always @(posedge sd_clk)
if (read_en && rx_valid)
begin
mem_buf[rx_addr] <= rx_data;
rx_addr <= rx_addr + 1;
end else if (read_en && rx_good)
begin
// mem_blkwrite(read_posn);
for(write_ik=0; write_ik<512/4; write_ik=write_ik+1)
mem[write_ik+read_posn] = mem_buf[write_ik];
read_posn = read_posn + 512/4;
end
initial begin
pending_write = 0;
write_en = 1'b0;
tx_valid = 1'b0;
tx_data = 0;
tx_last = 1'b0;
end
initial internal_card_busy = 1'b0;
always @(posedge sd_clk)
if (cmd_valid && !cmd_crc_err && { cmd_alt, cmd[5:0] } == 7'd12
&& card_selected)
begin // STOP_TRANSMISSION
write_en <= 1'b0;
tx_valid <= 1'b0;
tx_addr <= 0;
tx_last <= 0;
end else if (pending_write && !reply_valid && !reply_busy)
begin
// We can place a delay here, to simulate read access time
// if desired ...
if (!internal_card_busy && !stop_transmission)
begin
pending_write <= 1'b0;
if (!stop_transmission && (cmd[5:0] == 6'd17
|| cmd[5:0] == 6'd18))
begin
write_en <= 1'b1;
mem_blkread(read_posn);
read_posn = read_posn + 512/4;
tx_valid <= 1'b1;
tx_data <= mem_buf[0];
tx_addr <= 1;
tx_last <= 0;
end
end
end else if (write_en && tx_valid && tx_ready)
begin
tx_data <= mem_buf[tx_addr];
if (tx_last)
begin
tx_valid <= 1'b0;
tx_addr <= 0;
// write_en <= 1'b0;
end else
tx_addr <= tx_addr + 1;
tx_last <= tx_last || (&tx_addr[6:0]);
end else if (write_en && !tx_valid)
begin
if (tx_ready)
begin
write_en <= 1'b0;
internal_card_busy <= 1'b1;
internal_card_busy <= #READ_TIME 1'b0;
if (multi_block)
pending_write <= 1'b1;
end
end else if (!write_en)
begin
tx_valid <= 0;
tx_data <= 0;
tx_last <= 0;
end
// }}}
// Card busy can only change on a clock, so let's make sure we only
// change it on a clock.
initial card_busy <= 1'b0;
always @(posedge sd_clk)
card_busy <= internal_card_busy;
// assign sd_ds = #DS_DELAY (ds_enabled
// && (tx_ds || (enhanced_ds_enabled && cmd_ds));
// assign sd_dat[0] = (card_busy && card_selected && !pending_write) ? 1'b0 : 1'bz;
reg busy_indication;
reg [2:0] busy_wait;
initial busy_indication = 0;
initial busy_wait = 0;
always @(negedge sd_clk)
if (!internal_card_busy || write_en || pending_write)
begin
busy_indication <= 1'b0;
busy_wait <= 0;
end else if (busy_wait > 0)
begin
busy_wait <= busy_wait - 1;
busy_indication <= (busy_wait <= 1);
end else if (!busy_indication)
begin
// busy_indication <= 1'b0;
busy_wait <= 6;
end
assign sd_dat[0] = (busy_indication && !read_en) ? 1'b0 : 1'bz;
endmodule