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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
|
// verilator lint_off WIDTHEXPAND
// verilator lint_off WIDTHTRUNC
/////////////////////////////////////////////////////////////////////
//// ////
//// Author: Eyal Hochberg ////
//// eyal@provartec.com ////
//// ////
//// Downloaded from: http://www.opencores.org ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2010 Provartec LTD ////
//// www.provartec.com ////
//// info@provartec.com ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// This source file is free software; you can redistribute it ////
//// and/or modify it under the terms of the GNU Lesser General ////
//// Public License as published by the Free Software Foundation.////
//// ////
//// This source is distributed in the hope that it will be ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
//// PURPOSE. See the GNU Lesser General Public License for more////
//// details. http://www.gnu.org/licenses/lgpl.html ////
//// ////
/////////////////////////////////////////////////////////////////////
//---------------------------------------------------------
//-- File generated by RobustVerilog parser
//-- Version: 1.0
//-- Invoked Fri Mar 25 23:34:53 2011
//--
//-- Source file: dma_ch_reg.v
//---------------------------------------------------------
module dma_axi32_core0_ch_reg(clk,clken,pclken,reset,psel,penable,paddr,pwrite,pwdata,prdata,pslverr,timeout_bus,wdt_timeout,ch_start,load_addr,load_in_prog,load_req_in_prog,load_wr,load_wr_cycle,load_wdata,load_cmd,rd_ch_end,wr_ch_end,wr_clr_last,rd_slverr,rd_decerr,wr_slverr,wr_decerr,int_all_proc,ch_rd_active,ch_wr_active,ch_in_prog,rd_x_offset,rd_y_offset,wr_x_offset,wr_y_offset,wr_fullness,rd_gap,fifo_overflow,fifo_underflow,ch_update,rd_start_addr,wr_start_addr,x_size,y_size,rd_burst_max_size,wr_burst_max_size,block,allow_line_cmd,frame_width,width_align,rd_periph_delay,rd_periph_block,wr_periph_delay,wr_periph_block,rd_tokens,wr_tokens,rd_port_num,wr_port_num,rd_outs_max,wr_outs_max,rd_outs,wr_outs,outs_empty,rd_wait_limit,wr_wait_limit,rd_incr,wr_incr,rd_periph_num,wr_periph_num,wr_outstanding,rd_outstanding,ch_retry_wait,joint_mode,joint_remote,joint_cross,page_cross,joint,joint_flush,end_swap);
parameter DATA_SHIFT = 1 ? 32 : 0;
input clk;
input clken;
input pclken;
input reset;
input psel;
input penable;
input [7:0] paddr;
input pwrite;
input [31:0] pwdata;
output [31:0] prdata;
output pslverr;
input [4:0] timeout_bus;
input wdt_timeout;
input ch_start;
output [32-1:0] load_addr;
output load_in_prog;
output load_req_in_prog;
input load_wr;
input [1:0] load_wr_cycle;
input [32-1:0] load_wdata;
input load_cmd;
input rd_ch_end;
input wr_ch_end;
input wr_clr_last;
input rd_slverr;
input rd_decerr;
input wr_slverr;
input wr_decerr;
output [1-1:0] int_all_proc;
output ch_rd_active;
output ch_wr_active;
output ch_in_prog;
input [10-1:0] rd_x_offset;
input [10-`X_BITS-1:0] rd_y_offset;
input [10-1:0] wr_x_offset;
input [10-`X_BITS-1:0] wr_y_offset;
input [5:0] wr_fullness;
input [5:0] rd_gap;
input fifo_overflow;
input fifo_underflow;
output ch_update;
output [32-1:0] rd_start_addr;
output [32-1:0] wr_start_addr;
output [10-1:0] x_size;
output [10-`X_BITS-1:0] y_size;
output [7-1:0] rd_burst_max_size;
output [7-1:0] wr_burst_max_size;
output block;
input allow_line_cmd;
output [`FRAME_BITS-1:0] frame_width;
output [2-1:0] width_align;
output [`DELAY_BITS-1:0] rd_periph_delay;
output rd_periph_block;
output [`DELAY_BITS-1:0] wr_periph_delay;
output wr_periph_block;
output [`TOKEN_BITS-1:0] rd_tokens;
output [`TOKEN_BITS-1:0] wr_tokens;
output rd_port_num;
output wr_port_num;
output [`OUT_BITS-1:0] rd_outs_max;
output [`OUT_BITS-1:0] wr_outs_max;
input [`OUT_BITS-1:0] rd_outs;
input [`OUT_BITS-1:0] wr_outs;
input outs_empty;
output [`WAIT_BITS-1:0] rd_wait_limit;
output [`WAIT_BITS-1:0] wr_wait_limit;
output rd_incr;
output wr_incr;
output [4:0] rd_periph_num;
output [4:0] wr_periph_num;
output wr_outstanding;
output rd_outstanding;
output ch_retry_wait;
input joint_mode;
input joint_remote;
input joint_cross;
input page_cross;
output joint;
input joint_flush;
output [1:0] end_swap;
`include "dma_axi32_ch_reg_params.v"
parameter INT_NUM = 13;
wire [7:0] gpaddr;
wire gpwrite;
wire gpread;
reg [31:0] prdata_pre;
reg pslverr_pre;
reg [31:0] prdata;
reg pslverr;
reg ch_enable;
reg ch_in_prog;
reg rd_ch_in_prog;
reg wr_ch_in_prog;
reg load_in_prog_reg;
reg load_req_in_prog_reg;
//current cmd
reg [32-1:0] rd_start_addr;
reg [32-1:0] wr_start_addr;
reg [10-1:0] buff_size;
wire [10-1:0] x_size;
wire [10-`X_BITS-1:0] y_size;
reg [`FRAME_BITS-1:0] frame_width_reg;
reg block_reg;
reg joint_reg;
reg simple_mem;
wire joint;
wire joint_mux;
reg auto_retry_reg;
wire auto_retry;
reg [1:0] end_swap_reg;
//static
wire [7-1:0] rd_burst_max_size_rd;
wire [7-1:0] rd_burst_max_size_pre;
reg [7-1:0] rd_burst_max_size_reg;
reg [`DELAY_BITS-1:0] rd_periph_delay_reg;
reg rd_periph_block_reg;
reg [`TOKEN_BITS-1:0] rd_tokens_reg;
reg [`OUT_BITS-1:0] rd_outs_max_reg;
reg rd_port_num_reg;
reg cmd_port_num_reg;
wire rd_port_num_cfg;
wire cmd_port_num;
reg rd_outstanding_reg;
wire rd_outstanding_cfg;
reg rd_incr_reg;
reg [4:0] rd_periph_num_reg;
reg [`WAIT_BITS-1:4] rd_wait_limit_reg;
wire [7-1:0] wr_burst_max_size_rd;
wire [7-1:0] wr_burst_max_size_pre;
reg [7-1:0] wr_burst_max_size_reg;
reg [`DELAY_BITS-1:0] wr_periph_delay_reg;
reg wr_periph_block_reg;
reg [`TOKEN_BITS-1:0] wr_tokens_reg;
reg [`OUT_BITS-1:0] wr_outs_max_reg;
reg wr_port_num_reg;
reg wr_outstanding_reg;
wire wr_outstanding_cfg;
reg wr_incr_reg;
reg [4:0] wr_periph_num_reg;
reg [`WAIT_BITS-1:4] wr_wait_limit_reg;
wire rd_allow_full_fifo;
wire wr_allow_full_fifo;
wire allow_full_fifo;
wire allow_full_burst;
wire allow_joint_burst;
wire burst_max_size_update_pre;
wire burst_max_size_update;
reg cmd_set_int_reg;
reg cmd_last_reg;
reg [32-1:2] cmd_next_addr_reg;
reg [`CMD_CNT_BITS-1:0] cmd_counter_reg;
reg [`INT_CNT_BITS-1:0] int_counter_reg;
wire cmd_set_int;
wire cmd_last;
wire [32-1:2] cmd_next_addr;
wire [`CMD_CNT_BITS-1:0] cmd_counter;
wire [`INT_CNT_BITS-1:0] int_counter;
//interrupt
wire ch_end;
wire ch_end_set;
wire ch_end_clear;
wire ch_end_int;
wire [2:0] int_proc_num;
reg [2:0] int_proc_num_reg;
wire [INT_NUM-1:0] int_bus;
wire [INT_NUM-1:0] int_rawstat;
reg [INT_NUM-1:0] int_enable;
wire [INT_NUM-1:0] int_status;
wire [7:0] int_all_proc_bus;
wire wr_cmd_line0;
wire wr_cmd_line1;
wire wr_cmd_line2;
wire wr_cmd_line3;
wire wr_static_line0;
wire wr_static_line1;
wire wr_static_line2;
wire wr_static_line3;
wire wr_static_line4;
wire wr_ch_enable;
wire wr_ch_start;
wire wr_int_rawstat;
wire wr_int_clear;
wire wr_int_enable;
wire wr_frame_width;
reg [31:0] rd_cmd_line0;
reg [31:0] rd_cmd_line1;
reg [31:0] rd_cmd_line2;
reg [31:0] rd_cmd_line3;
reg [31:0] rd_static_line0;
reg [31:0] rd_static_line1;
reg [31:0] rd_static_line2;
reg [31:0] rd_static_line3;
reg [31:0] rd_static_line4;
reg [31:0] rd_restrict;
reg [31:0] rd_rd_offsets;
reg [31:0] rd_wr_offsets;
reg [31:0] rd_fifo_fullness;
reg [31:0] rd_cmd_outs;
reg [31:0] rd_ch_enable;
reg [31:0] rd_ch_active;
reg [31:0] rd_cmd_counter;
reg [31:0] rd_int_rawstat;
reg [31:0] rd_int_enable;
reg [31:0] rd_int_status;
wire load_wr_cycle0;
wire load_wr_cycle1;
wire load_wr_cycle2;
wire load_wr_cycle3;
wire load_wr0;
wire load_wr1;
wire load_wr2;
wire load_wr3;
wire load_wr_last;
wire load_req;
wire timeout_aw;
wire timeout_w;
wire timeout_b;
wire timeout_ar;
wire timeout_r;
wire ch_retry_wait_pre;
reg ch_retry_wait_reg;
wire ch_retry_wait;
wire ch_retry;
wire ch_update_pre;
reg ch_update;
wire ch_update_d;
wire ch_int;
//---------------------- gating -------------------------------------
//assign gpaddr = {8{psel}} & paddr;
assign gpaddr = paddr; //removed for timing
assign gpwrite = psel & (~penable) & pwrite;
assign gpread = psel & (~penable) & (~pwrite);
//---------------------- Write Operations ----------------------------------
assign wr_cmd_line0 = gpwrite & gpaddr == CMD_LINE0;
assign wr_cmd_line1 = gpwrite & gpaddr == CMD_LINE1;
assign wr_cmd_line2 = gpwrite & gpaddr == CMD_LINE2;
assign wr_cmd_line3 = gpwrite & gpaddr == CMD_LINE3;
assign wr_static_line0 = gpwrite & gpaddr == STATIC_LINE0;
assign wr_static_line1 = gpwrite & gpaddr == STATIC_LINE1;
assign wr_static_line2 = gpwrite & gpaddr == STATIC_LINE2;
assign wr_static_line3 = gpwrite & gpaddr == STATIC_LINE3;
assign wr_static_line4 = gpwrite & gpaddr == STATIC_LINE4;
assign wr_ch_enable = gpwrite & gpaddr == CH_ENABLE;
assign wr_ch_start = (gpwrite & gpaddr == CH_START) | ch_start;
assign wr_int_rawstat = gpwrite & gpaddr == INT_RAWSTAT;
assign wr_int_clear = gpwrite & gpaddr == INT_CLEAR;
assign wr_int_enable = gpwrite & gpaddr == INT_ENABLE;
assign load_wr_cycle0 = load_wr & load_wr_cycle == 2'd0;
assign load_wr_cycle1 = load_wr & load_wr_cycle == 2'd1;
assign load_wr_cycle2 = load_wr & load_wr_cycle == 2'd2;
assign load_wr_cycle3 = load_wr & load_wr_cycle == 2'd3;
assign load_wr0 = 1 ? load_wr_cycle0 : load_wr_cycle0;
assign load_wr1 = 1 ? load_wr_cycle1 : load_wr_cycle0;
assign load_wr2 = 1 ? load_wr_cycle2 : load_wr_cycle1;
assign load_wr3 = 1 ? load_wr_cycle3 : load_wr_cycle1;
assign load_wr_last = load_wr3;
always @(posedge clk or posedge reset)
if (reset)
begin
rd_start_addr <= {32{1'b0}};
end
else if (wr_cmd_line0)
begin
rd_start_addr <= pwdata[32-1:0];
end
else if (load_wr0)
begin
rd_start_addr <= load_wdata[32-1:0];
end
always @(posedge clk or posedge reset)
if (reset)
begin
wr_start_addr <= {32{1'b0}};
end
else if (wr_cmd_line1)
begin
wr_start_addr <= pwdata[32-1:0];
end
else if (load_wr1)
begin
wr_start_addr <= load_wdata[32+32-DATA_SHIFT-1:32-DATA_SHIFT];
end
always @(posedge clk or posedge reset)
if (reset)
begin
buff_size <= {10{1'b0}};
end
else if (wr_cmd_line2)
begin
buff_size <= pwdata[10-1:0];
end
else if (load_wr2)
begin
buff_size <= load_wdata[10-1:0];
end
always @(posedge clk or posedge reset)
if (reset)
begin
cmd_set_int_reg <= 1'b0;
cmd_last_reg <= 1'b0;
cmd_next_addr_reg <= {30{1'b0}};
end
else if (wr_cmd_line3)
begin
cmd_set_int_reg <= pwdata[0];
cmd_last_reg <= pwdata[1];
cmd_next_addr_reg <= pwdata[32-1:2];
end
else if (load_wr3)
begin
cmd_set_int_reg <= load_wdata[32-DATA_SHIFT];
cmd_last_reg <= load_wdata[33-DATA_SHIFT];
cmd_next_addr_reg <= load_wdata[32+32-DATA_SHIFT-1:34-DATA_SHIFT];
end
always @(posedge clk or posedge reset)
if (reset)
cmd_counter_reg <= {`CMD_CNT_BITS{1'b0}};
else if (wr_ch_start)
cmd_counter_reg <= {`CMD_CNT_BITS{1'b0}};
else if (ch_end & clken)
cmd_counter_reg <= cmd_counter_reg + 1'b1;
always @(posedge clk or posedge reset)
if (reset)
int_counter_reg <= {`INT_CNT_BITS{1'b0}};
else if (wr_ch_start)
int_counter_reg <= {`INT_CNT_BITS{1'b0}};
else if ((ch_end_int & clken) | ch_end_clear)
int_counter_reg <= int_counter_reg + (ch_end_int & clken) - ch_end_clear;
assign cmd_set_int = cmd_set_int_reg;
assign cmd_last = cmd_last_reg;
assign cmd_next_addr = cmd_next_addr_reg;
assign cmd_counter = cmd_counter_reg;
assign int_counter = int_counter_reg;
assign x_size = block ? {{10-`X_BITS{1'b0}}, buff_size[`X_BITS-1:0]} : buff_size;
assign y_size = block ? buff_size[10-1:`X_BITS] : 'd1;
always @(posedge clk or posedge reset)
if (reset)
begin
rd_burst_max_size_reg <= 'd0;
rd_tokens_reg <= 'd1;
rd_outs_max_reg <= {`OUT_BITS{1'b0}};
rd_incr_reg <= 'd1;
end
else if (wr_static_line0)
begin
rd_burst_max_size_reg <= pwdata[7-1:0];
rd_tokens_reg <= pwdata[`TOKEN_BITS+16-1:16];
rd_outs_max_reg <= pwdata[`OUT_BITS+24-1:24];
rd_incr_reg <= pwdata[31];
end
always @(posedge clk or posedge reset)
if (reset)
begin
wr_burst_max_size_reg <= 'd0;
wr_tokens_reg <= 'd1;
wr_outs_max_reg <= {`OUT_BITS{1'b0}};
wr_incr_reg <= 'd1;
end
else if (wr_static_line1)
begin
wr_burst_max_size_reg <= pwdata[7-1:0];
wr_tokens_reg <= pwdata[`TOKEN_BITS+16-1:16];
wr_outs_max_reg <= pwdata[`OUT_BITS+24-1:24];
wr_incr_reg <= pwdata[31];
end
assign rd_incr = rd_incr_reg;
assign wr_incr = wr_incr_reg;
assign rd_outstanding_cfg = 1'b0;
assign wr_outstanding_cfg = 1'b0;
assign rd_outstanding = 1'b0;
assign wr_outstanding = 1'b0;
assign rd_tokens = rd_tokens_reg;
assign wr_tokens = joint_mux ? rd_tokens_reg : wr_tokens_reg;
assign rd_outs_max = rd_outs_max_reg;
assign wr_outs_max = joint_mux ? rd_outs_max_reg : wr_outs_max_reg;
assign rd_allow_full_fifo = rd_start_addr[5-1:0] == 'd0;
assign wr_allow_full_fifo = wr_start_addr[5-1:0] == 'd0;
assign allow_full_fifo = rd_allow_full_fifo & wr_allow_full_fifo;
assign rd_burst_max_size = rd_burst_max_size_pre;
assign wr_burst_max_size = joint_mux ? rd_burst_max_size_pre : wr_burst_max_size_pre;
assign allow_joint_burst = joint & (~joint_flush) & (~page_cross) & (~joint_cross);
assign allow_full_burst = allow_joint_burst;
assign burst_max_size_update_pre = ch_update | ch_update_d | joint;
prgen_delay #(1) delay_max_size_update (.clk(clk), .reset(reset), .din(burst_max_size_update_pre), .dout(burst_max_size_update));
dma_axi32_core0_ch_reg_size
dma_axi32_core0_ch_reg_size_rd (
.clk(clk),
.reset(reset),
.update(burst_max_size_update),
.start_addr(rd_start_addr),
.burst_max_size_reg(rd_burst_max_size_reg),
.burst_max_size_other(wr_burst_max_size_rd),
.allow_full_burst(allow_full_burst),
.allow_full_fifo(allow_full_fifo),
.joint_flush(joint_flush),
.burst_max_size(rd_burst_max_size_pre)
);
dma_axi32_core0_ch_reg_size
dma_axi32_core0_ch_reg_size_wr (
.clk(clk),
.reset(reset),
.update(burst_max_size_update),
.start_addr(wr_start_addr),
.burst_max_size_reg(wr_burst_max_size_reg),
.burst_max_size_other(rd_burst_max_size_reg),
.allow_full_burst(1'b0),
.allow_full_fifo(allow_full_fifo),
.joint_flush(joint_flush),
.burst_max_size(wr_burst_max_size_pre)
);
always @(posedge clk or posedge reset)
if (reset)
begin
joint_reg <= 1'b1;
end_swap_reg <= 2'b00;
end
else if (wr_static_line2)
begin
joint_reg <= pwdata[16];
end_swap_reg <= pwdata[29:28];
end
always @(posedge clk or posedge reset)
if (reset)
simple_mem <= 1'b0;
else if (ch_update)
simple_mem <= (rd_periph_num == 'd0) & (wr_periph_num == 'd0) & (~allow_line_cmd);
assign joint = joint_mode & joint_reg & simple_mem & 1'b1;
assign joint_mux = joint;
assign cmd_port_num = 1'b0;
assign rd_port_num_cfg = 1'b0;
assign wr_port_num = 1'b0;
assign rd_port_num = 1'b0;
assign frame_width = {`FRAME_BITS{1'b0}};
assign block = 1'b0;
assign width_align = frame_width[2-1:0];
assign rd_wait_limit = {`WAIT_BITS-4{1'b0}};
assign wr_wait_limit = {`WAIT_BITS-4{1'b0}};
always @(posedge clk or posedge reset)
if (reset)
begin
rd_periph_num_reg <= 'd0; //0 is memory
rd_periph_delay_reg <= 'd0; //0 is memory
wr_periph_num_reg <= 'd0; //0 is memory
wr_periph_delay_reg <= 'd0; //0 is memory
end
else if (wr_static_line4)
begin
rd_periph_num_reg <= pwdata[4:0];
rd_periph_delay_reg <= pwdata[`DELAY_BITS+8-1:8];
wr_periph_num_reg <= pwdata[20:16];
wr_periph_delay_reg <= pwdata[`DELAY_BITS+24-1:24];
end
assign rd_periph_num = rd_periph_num_reg;
assign wr_periph_num = wr_periph_num_reg;
assign rd_periph_delay = rd_periph_delay_reg;
assign wr_periph_delay = wr_periph_delay_reg;
assign rd_periph_block = 1'b0;
assign wr_periph_block = 1'b0;
always @(posedge clk or posedge reset)
if (reset)
begin
ch_enable <= 1'b1;
end
else if (wr_ch_enable)
begin
ch_enable <= pwdata[0];
end
always @(posedge clk or posedge reset)
if (reset)
ch_in_prog <= 1'b0;
else if (ch_update)
ch_in_prog <= 1'b1;
else if (ch_end & clken)
ch_in_prog <= 1'b0;
always @(posedge clk or posedge reset)
if (reset)
rd_ch_in_prog <= 1'b0;
else if (ch_update)
rd_ch_in_prog <= 1'b1;
else if (fifo_underflow | fifo_overflow)
rd_ch_in_prog <= 1'b0;
else if (rd_ch_end & clken)
rd_ch_in_prog <= 1'b0;
always @(posedge clk or posedge reset)
if (reset)
wr_ch_in_prog <= 1'b0;
else if (ch_update)
wr_ch_in_prog <= 1'b1;
else if (fifo_underflow | fifo_overflow)
wr_ch_in_prog <= 1'b0;
else if (wr_ch_end & clken)
wr_ch_in_prog <= 1'b0;
always @(posedge clk or posedge reset)
if (reset)
load_in_prog_reg <= 1'b0;
else if (load_req & clken)
load_in_prog_reg <= 1'b1;
else if (ch_update & clken)
load_in_prog_reg <= 1'b0;
always @(posedge clk or posedge reset)
if (reset)
load_req_in_prog_reg <= 1'b0;
else if (load_req & clken)
load_req_in_prog_reg <= 1'b1;
else if (load_cmd & clken)
load_req_in_prog_reg <= 1'b0;
assign load_in_prog = load_in_prog_reg;
assign load_req_in_prog = load_req_in_prog_reg;
assign auto_retry = 1'b0;
assign ch_retry_wait = 1'b0;
assign ch_retry = 1'b0;
assign ch_update_pre = wr_ch_start | load_wr_last | ch_retry;
always @(posedge clk or posedge reset)
if (reset)
ch_update <= 1'b0;
else if (ch_update_pre)
ch_update <= 1'b1;
else if (clken)
ch_update <= 1'b0;
prgen_delay #(1) delay_ch_update (.clk(clk), .reset(reset), .din(ch_update), .dout(ch_update_d));
assign load_req = (ch_enable & ch_end & (~cmd_last)) | (ch_update & (x_size == 'd0));
assign load_addr = {cmd_next_addr[32-1:2], 2'b00};
assign ch_end = rd_ch_end & wr_ch_end & wr_clr_last & (~ch_retry_wait);
assign ch_end_int = ch_enable & ch_end & cmd_set_int;
assign ch_rd_active = ch_enable & (rd_ch_in_prog | load_req_in_prog);
assign ch_wr_active = ch_enable & wr_ch_in_prog;
assign ch_end_set = |int_counter;
assign ch_end_clear = wr_int_clear & pwdata[0];
assign {timeout_aw,
timeout_w,
timeout_b,
timeout_ar,
timeout_r} = timeout_bus[4:0];
assign int_bus = {INT_NUM{clken}} & {
wdt_timeout,
timeout_aw,
timeout_w,
timeout_b,
timeout_ar,
timeout_r,
fifo_underflow,
fifo_overflow,
wr_decerr,
rd_decerr,
wr_slverr,
rd_slverr,
ch_end_set
};
prgen_rawstat #(INT_NUM) rawstat(
.clk(clk),
.reset(reset),
.clear(wr_int_clear),
.write(wr_int_rawstat),
.pwdata(pwdata[INT_NUM-1:0]),
.int_bus(int_bus),
.rawstat(int_rawstat)
);
always @(posedge clk or posedge reset)
if (reset)
int_enable <= {INT_NUM{1'b1}};
else if (wr_int_enable)
int_enable <= pwdata[INT_NUM-1:0];
assign int_status = int_rawstat & int_enable;
assign ch_int = |int_status;
assign int_proc_num = 3'd0;
assign int_all_proc = ch_int;
assign end_swap = end_swap_reg;
//---------------------- Read Operations -----------------------------------
assign rd_burst_max_size_rd = rd_burst_max_size_reg;
assign wr_burst_max_size_rd = wr_burst_max_size_reg;
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
always @(allow_full_burst or allow_full_fifo
or allow_joint_burst or allow_line_cmd or auto_retry
or block or buff_size or ch_enable or ch_rd_active
or ch_wr_active or cmd_counter or cmd_last
or cmd_next_addr or cmd_port_num or cmd_set_int
or end_swap or frame_width or int_counter or int_enable
or int_proc_num or int_rawstat or int_status or joint_reg
or rd_allow_full_fifo or rd_burst_max_size_rd or rd_gap
or rd_incr or rd_outs or rd_outs_max or rd_outstanding
or rd_outstanding_cfg or rd_periph_block_reg
or rd_periph_delay or rd_periph_num or rd_port_num_cfg
or rd_start_addr or rd_tokens or rd_wait_limit
or rd_x_offset or rd_y_offset or simple_mem
or wr_allow_full_fifo or wr_burst_max_size_rd
or wr_fullness or wr_incr or wr_outs or wr_outs_max
or wr_outstanding or wr_outstanding_cfg
or wr_periph_block_reg or wr_periph_delay or wr_periph_num
or wr_port_num or wr_start_addr or wr_tokens
or wr_wait_limit or wr_x_offset or wr_y_offset)
begin
rd_cmd_line0 = {32{1'b0}};
rd_cmd_line1 = {32{1'b0}};
rd_cmd_line2 = {32{1'b0}};
rd_cmd_line3 = {32{1'b0}};
rd_static_line0 = {32{1'b0}};
rd_static_line1 = {32{1'b0}};
rd_static_line2 = {32{1'b0}};
rd_static_line3 = {32{1'b0}};
rd_static_line4 = {32{1'b0}};
rd_restrict = {32{1'b0}};
rd_rd_offsets = {32{1'b0}};
rd_wr_offsets = {32{1'b0}};
rd_fifo_fullness = {32{1'b0}};
rd_cmd_outs = {32{1'b0}};
rd_ch_enable = {32{1'b0}};
rd_ch_active = {32{1'b0}};
rd_cmd_counter = {32{1'b0}};
rd_int_rawstat = {32{1'b0}};
rd_int_enable = {32{1'b0}};
rd_int_status = {32{1'b0}};
rd_cmd_line0[32-1:0] = rd_start_addr;
rd_cmd_line1[32-1:0] = wr_start_addr;
rd_cmd_line2[10-1:0] = buff_size;
rd_cmd_line3[0] = cmd_set_int;
rd_cmd_line3[1] = cmd_last;
rd_cmd_line3[32-1:2] = cmd_next_addr;
rd_static_line0[7-1:0] = rd_burst_max_size_rd;
rd_static_line0[`TOKEN_BITS+16-1:16] = rd_tokens;
rd_static_line0[`OUT_BITS+24-1:24] = rd_outs_max;
rd_static_line0[30] = rd_outstanding_cfg;
rd_static_line0[31] = rd_incr;
rd_static_line1[7-1:0] = wr_burst_max_size_rd;
rd_static_line1[`TOKEN_BITS+16-1:16] = wr_tokens;
rd_static_line1[`OUT_BITS+24-1:24] = wr_outs_max;
rd_static_line1[30] = wr_outstanding_cfg;
rd_static_line1[31] = wr_incr;
rd_static_line2[`FRAME_BITS-1:0] = frame_width;
rd_static_line2[15] = block;
rd_static_line2[16] = joint_reg;
rd_static_line2[17] = auto_retry;
rd_static_line2[20] = cmd_port_num;
rd_static_line2[21] = rd_port_num_cfg;
rd_static_line2[22] = wr_port_num;
rd_static_line2[26:24] = int_proc_num;
rd_static_line2[29:28] = end_swap;
rd_static_line4[4:0] = rd_periph_num;
rd_static_line4[`DELAY_BITS+8-1:8] = rd_periph_delay;
rd_static_line4[20:16] = wr_periph_num;
rd_static_line4[`DELAY_BITS+24-1:24] = wr_periph_delay;
rd_restrict[0] = rd_allow_full_fifo;
rd_restrict[1] = wr_allow_full_fifo;
rd_restrict[2] = allow_full_fifo;
rd_restrict[3] = allow_full_burst;
rd_restrict[4] = allow_joint_burst;
rd_restrict[5] = rd_outstanding;
rd_restrict[6] = wr_outstanding;
rd_restrict[7] = allow_line_cmd;
rd_restrict[8] = simple_mem;
rd_rd_offsets[10-1:0] = rd_x_offset;
rd_rd_offsets[10-`X_BITS+16-1:16] = rd_y_offset;
rd_wr_offsets[10-1:0] = wr_x_offset;
rd_wr_offsets[10-`X_BITS+16-1:16] = wr_y_offset;
rd_fifo_fullness[5:0] = rd_gap;
rd_fifo_fullness[5+16:16] = wr_fullness;
rd_cmd_outs[`OUT_BITS-1:0] = rd_outs;
rd_cmd_outs[`OUT_BITS-1+8:8] = wr_outs;
rd_ch_enable[0] = ch_enable;
rd_ch_active[0] = ch_rd_active;
rd_ch_active[1] = ch_wr_active;
rd_cmd_counter[`CMD_CNT_BITS-1:0] = cmd_counter;
rd_cmd_counter[`INT_CNT_BITS-1+16:16] = int_counter;
rd_int_rawstat[INT_NUM-1:0] = int_rawstat;
rd_int_enable[INT_NUM-1:0] = int_enable;
rd_int_status[INT_NUM-1:0] = int_status;
end
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
always @(gpaddr or rd_ch_active or rd_ch_enable
or rd_cmd_counter or rd_cmd_line0 or rd_cmd_line1
or rd_cmd_line2 or rd_cmd_line3 or rd_cmd_outs
or rd_fifo_fullness or rd_int_enable or rd_int_rawstat
or rd_int_status or rd_rd_offsets or rd_restrict
or rd_static_line0 or rd_static_line1 or rd_static_line2
or rd_static_line3 or rd_static_line4 or rd_wr_offsets)
begin
prdata_pre = {32{1'b0}};
case (gpaddr)
CMD_LINE0 : prdata_pre = rd_cmd_line0;
CMD_LINE1 : prdata_pre = rd_cmd_line1;
CMD_LINE2 : prdata_pre = rd_cmd_line2;
CMD_LINE3 : prdata_pre = rd_cmd_line3;
STATIC_LINE0 : prdata_pre = rd_static_line0;
STATIC_LINE1 : prdata_pre = rd_static_line1;
STATIC_LINE2 : prdata_pre = rd_static_line2;
STATIC_LINE3 : prdata_pre = rd_static_line3;
STATIC_LINE4 : prdata_pre = rd_static_line4;
RESTRICT : prdata_pre = rd_restrict;
RD_OFFSETS : prdata_pre = rd_rd_offsets;
WR_OFFSETS : prdata_pre = rd_wr_offsets;
FIFO_FULLNESS : prdata_pre = rd_fifo_fullness;
CMD_OUTS : prdata_pre = rd_cmd_outs;
CH_ENABLE : prdata_pre = rd_ch_enable;
CH_START : prdata_pre = {32{1'b0}};
CH_ACTIVE : prdata_pre = rd_ch_active;
CH_CMD_COUNTER : prdata_pre = rd_cmd_counter;
INT_RAWSTAT : prdata_pre = rd_int_rawstat;
INT_CLEAR : prdata_pre = {32{1'b0}};
INT_ENABLE : prdata_pre = rd_int_enable;
INT_STATUS : prdata_pre = rd_int_status;
default : prdata_pre = {32{1'b0}};
endcase
end
//always @(/*AUTOSENSE*/) - no AUTOSENSE because of include file
always @(gpaddr or gpread or gpwrite or psel)
begin
pslverr_pre = 1'b0;
case (gpaddr)
CMD_LINE0 : pslverr_pre = 1'b0; //read and write
CMD_LINE1 : pslverr_pre = 1'b0; //read and write
CMD_LINE2 : pslverr_pre = 1'b0; //read and write
CMD_LINE3 : pslverr_pre = 1'b0; //read and write
STATIC_LINE0 : pslverr_pre = 1'b0; //read and write
STATIC_LINE1 : pslverr_pre = 1'b0; //read and write
STATIC_LINE2 : pslverr_pre = 1'b0; //read and write
STATIC_LINE3 : pslverr_pre = 1'b0; //read and write
STATIC_LINE4 : pslverr_pre = 1'b0; //read and write
RESTRICT : pslverr_pre = gpwrite; //read only
RD_OFFSETS : pslverr_pre = gpwrite; //read only
WR_OFFSETS : pslverr_pre = gpwrite; //read only
FIFO_FULLNESS : pslverr_pre = gpwrite; //read only
CMD_OUTS : pslverr_pre = gpwrite; //read only
CH_ENABLE : pslverr_pre = 1'b0; //read and write
CH_START : pslverr_pre = gpread; //write only
CH_ACTIVE : pslverr_pre = gpwrite; //read only
CH_CMD_COUNTER : pslverr_pre = gpwrite; //read only
INT_RAWSTAT : pslverr_pre = 1'b0; //read and write
INT_CLEAR : pslverr_pre = gpread; //write only
INT_ENABLE : pslverr_pre = 1'b0; //read and write
INT_STATUS : pslverr_pre = gpwrite; //read only
default : pslverr_pre = psel; //decode error
endcase
end
always @(posedge clk or posedge reset)
if (reset)
prdata <= {32{1'b0}};
else if (gpread & pclken)
prdata <= prdata_pre;
else if (pclken)
prdata <= {32{1'b0}};
always @(posedge clk or posedge reset)
if (reset)
pslverr <= 1'b0;
else if ((gpread | gpwrite) & pclken)
pslverr <= pslverr_pre;
else if (pclken)
pslverr <= 1'b0;
endmodule
// verilator lint_on WIDTHEXPAND
// verilator lint_on WIDTHTRUNC
|