-
Notifications
You must be signed in to change notification settings - Fork 0
/
test20_bidiremseek.sv
147 lines (132 loc) · 4.39 KB
/
test20_bidiremseek.sv
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
// vi:set ft=verilog ts=4 sw=4 expandtab ai si:
// [email protected] 20180807
`timescale 1ns/1ps
`default_nettype none
`include "../common.sv"
`include "./s00_defines.sv"
module TestBiDirEmSeek;
import SimSrcGen::*;
import BwaMemDefines::*;
logic clk, rst;
initial GenClk(clk, 8, 10);
initial GenRst(clk, rst, 2, 2);
// byte rstring[78] = "NCTTTATGGTTTGTAGTTTAAAACAAAGACAATAACAACCCTTTCCTAAAGCAGACATCCTTCTTGCCTGGGGACTNN"; // read 1
byte rstring[78] = "NCGGGAGGCTGAGGTAGGAGAATCACTTGAACCTGGGAAGCAGAGGTTGCAGTGAGCCGAGATCGTGCCACTGCACTN"; // read 5
// byte rstring[78] = "NCCCAGTAGCTCGGACTACAGGCACATACCACCACGCCTGGCTAATTTTTTATNTTNANNNGTGTAGATNNNGGTTNN"; // read 16
Symbol read[78];
initial begin
for(int i = 0; i < 78; i++) begin
case(rstring[i])
8'h41: read[i] = sym_A;
8'h43: read[i] = sym_C;
8'h47: read[i] = sym_G;
8'h54: read[i] = sym_T;
default: read[i] = sym_N;
endcase
end
end
logic [KLS_W-1:0] acc_cnt[0:3];
logic acc_cnt_valid;
logic [KLS_W-1:0] pri_pos;
logic pri_pos_valid;
logic [KLS_W-1:0] bwt_len;
logic bwt_len_valid;
logic [POS_W-1:0] min_mlen = 19;
logic min_mlen_valid;
logic start = 1'b0;
wire finish;
wire busy;
integer seed = 123321;
integer rnd;
always_ff @(posedge clk) begin : proc_rnd
if(rst) begin
rnd <= 0;
end else begin
rnd <= $random(seed);
end
end
Axi4StreamIf #(.DW_BYTES($bits(WorkingMem)/8)) axis_emout(.clk(clk), .reset_n(~rst));
wire WorkingMem emout = axis_emout.tdata;
always_comb axis_emout.tready = rnd[1:0] == 3'b00;//1'b1;
wire emout_handsk = axis_emout.tready & axis_emout.tvalid;
Axi4LiteIf #(.AW(40), .DW(256)) axi_occlu(clk, ~rst);
logic [POS_W-1:0] p, pNxt;
integer c_file, code;
initial begin
// check the order of those values in file!
c_file = $fopen("./hs37d5_cocc.bin.txt", "r");
code = $fscanf(c_file, "%d\n", acc_cnt[0]);
code = $fscanf(c_file, "%d\n", acc_cnt[1]);
code = $fscanf(c_file, "%d\n", acc_cnt[2]);
code = $fscanf(c_file, "%d\n", acc_cnt[3]);
code = $fscanf(c_file, "%d\n", bwt_len);
code = $fscanf(c_file, "%d\n", pri_pos);
$fclose(c_file);
do @(posedge clk);
while(~rst);
do @(posedge clk);
while(rst);
@(posedge clk) begin
bwt_len_valid <= 1'b1;
acc_cnt_valid <= 1'b1;
pri_pos_valid <= 1'b1;
min_mlen_valid <= 1'b1;
end
@(posedge clk) begin
bwt_len_valid <= 1'b0;
acc_cnt_valid <= 1'b0;
pri_pos_valid <= 1'b0;
min_mlen_valid <= 1'b0;
end
p = 1;
while(p < 78) begin
// for(p = 1; p < 78;) begin // this cause warning
@(posedge clk) begin
start <= 1'b1;
end
@(posedge clk) begin
start <= 1'b0;
end
while(1) begin
@(posedge clk) begin
if(finish) begin
p = pNxt;
start <= 1'b1;
break;
end
end
end
@(posedge clk) begin
start <= 1'b0;
end
end
@(posedge clk) begin
$stop();
end
end // initial
BiDirEmSeek #(78) the_dut (
.clk (clk),
.rst (rst),
.gd_read (read),
.pos_in (p),
.start (start),
.pos_out (pNxt),
.finish (finish),
.busy (busy),
.m_axis_emout (axis_emout.source),
.m_axi_occlu (axi_occlu.master),
.acc_cnt_in (acc_cnt),
.acc_cnt_valid (acc_cnt_valid),
.pri_pos_in (pri_pos),
.pri_pos_valid (pri_pos_valid),
.min_mlen_in (min_mlen),
.min_mlen_valid(min_mlen_valid),
.bwt_len_in (bwt_len),
.bwt_len_valid (bwt_len_valid)
);
FileROM #(.BASE_ADDR(64'd0), .MEAN_LATENCY(32))
theROM
(
.s_axi4l(axi_occlu.slave)
);
endmodule // TestExtension