Skip to content

Commit d5cfaee

Browse files
committed
Factor out cyclotron initialization
1 parent a664aa7 commit d5cfaee

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

src/main/resources/vsrc/Cyclotron.vh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ import "DPI-C" function cyclotron_difftest_reg(
2424
input int trace_regs_2_data[NUM_LANES]
2525
);
2626

27+
task automatic cyclotron_init_task();
28+
string elffile;
29+
elffile = vpi_get_binary();
30+
cyclotron_init(elffile);
31+
endtask
32+
2733
import "DPI-C" function void cyclotron_imem(
2834
output bit imem_req_ready,
2935
input bit imem_req_valid,
@@ -38,4 +44,3 @@ import "DPI-C" function void cyclotron_imem(
3844
output byte imem_resp_bits_tag,
3945
output longint imem_resp_bits_data
4046
);
41-

src/main/resources/vsrc/CyclotronBackend.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ module CyclotronBackendBlackBox #(
376376
longint __imem_resp_bits_data;
377377

378378
// initialize model at the rtl sim start
379-
initial begin
380-
cyclotron_init();
381-
end
379+
// use BINARY= argument (i.e. first non-plusarg argument) as the Cyclotron
380+
// ELF
381+
initial cyclotron_init_task();
382382

383383
// TODO: simulate backpressure
384384

src/main/resources/vsrc/CyclotronDiffTest.v

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,10 @@ module CyclotronDiffTestBlackBox #(
5353

5454
bit __in_finished;
5555

56-
string elffile;
57-
5856
// initialize model at the rtl sim start
5957
// use BINARY= argument (i.e. first non-plusarg argument) as the Cyclotron
6058
// ELF
61-
initial begin
62-
elffile = vpi_get_binary();
63-
cyclotron_init(elffile);
64-
end
59+
initial cyclotron_init_task();
6560

6661
// connect regtrace signals
6762
assign __out_trace_valid = trace_valid;

src/main/resources/vsrc/CyclotronFrontend.v

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,10 @@ module CyclotronFrontendBlackBox #(
102102

103103
bit __in_finished;
104104

105-
string elffile;
106-
107105
// initialize model at the rtl sim start
108106
// use BINARY= argument (i.e. first non-plusarg argument) as the Cyclotron
109107
// ELF
110-
initial begin
111-
elffile = vpi_get_binary();
112-
cyclotron_init(elffile);
113-
end
108+
initial cyclotron_init_task();
114109

115110
always @(negedge clock) begin
116111
cyclotron_imem(

0 commit comments

Comments
 (0)