switchboard-hw 0.3.0__cp314-cp314-macosx_10_15_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- _switchboard.cpython-314-darwin.so +0 -0
- switchboard/__init__.py +24 -0
- switchboard/ams.py +668 -0
- switchboard/apb.py +278 -0
- switchboard/autowrap.py +1000 -0
- switchboard/axi.py +571 -0
- switchboard/axil.py +348 -0
- switchboard/bitvector.py +112 -0
- switchboard/cmdline.py +142 -0
- switchboard/cpp/Makefile +13 -0
- switchboard/cpp/bitutil.h +39 -0
- switchboard/cpp/pagemap.h +91 -0
- switchboard/cpp/pciedev.h +86 -0
- switchboard/cpp/router.cc +89 -0
- switchboard/cpp/spsc_queue.h +267 -0
- switchboard/cpp/switchboard.hpp +257 -0
- switchboard/cpp/switchboard_pcie.hpp +234 -0
- switchboard/cpp/switchboard_tlm.hpp +98 -0
- switchboard/cpp/umilib.h +144 -0
- switchboard/cpp/umilib.hpp +113 -0
- switchboard/cpp/umisb.hpp +364 -0
- switchboard/cpp/xyce.hpp +90 -0
- switchboard/deps/__init__.py +0 -0
- switchboard/deps/verilog_axi.py +23 -0
- switchboard/dpi/__init__.py +0 -0
- switchboard/dpi/switchboard_dpi.cc +119 -0
- switchboard/dpi/switchboard_dpi.py +13 -0
- switchboard/dpi/xyce_dpi.cc +43 -0
- switchboard/gpio.py +108 -0
- switchboard/icarus.py +85 -0
- switchboard/loopback.py +157 -0
- switchboard/network.py +714 -0
- switchboard/pytest_plugin.py +11 -0
- switchboard/sbdesign.py +55 -0
- switchboard/sbdut.py +744 -0
- switchboard/sbtcp.py +345 -0
- switchboard/sc/__init__.py +0 -0
- switchboard/sc/morty/__init__.py +0 -0
- switchboard/sc/morty/uniquify.py +67 -0
- switchboard/sc/sed/__init__.py +0 -0
- switchboard/sc/sed/sed_remove.py +47 -0
- switchboard/sc/standalone_netlist_flow.py +25 -0
- switchboard/switchboard.py +53 -0
- switchboard/test_util.py +46 -0
- switchboard/uart_xactor.py +66 -0
- switchboard/umi.py +793 -0
- switchboard/util.py +131 -0
- switchboard/verilator/__init__.py +0 -0
- switchboard/verilator/config.vlt +13 -0
- switchboard/verilator/testbench.cc +143 -0
- switchboard/verilator/verilator.py +13 -0
- switchboard/verilator_run.py +31 -0
- switchboard/verilog/__init__.py +0 -0
- switchboard/verilog/common/__init__.py +0 -0
- switchboard/verilog/common/common.py +26 -0
- switchboard/verilog/common/switchboard.vh +429 -0
- switchboard/verilog/common/uart_xactor.sv +247 -0
- switchboard/verilog/common/umi_gpio.v +236 -0
- switchboard/verilog/fpga/__init__.py +0 -0
- switchboard/verilog/fpga/axi_reader.sv +82 -0
- switchboard/verilog/fpga/axi_writer.sv +111 -0
- switchboard/verilog/fpga/config_registers.sv +249 -0
- switchboard/verilog/fpga/fpga.py +21 -0
- switchboard/verilog/fpga/include/sb_queue_regmap.vh +21 -0
- switchboard/verilog/fpga/include/spsc_queue.vh +7 -0
- switchboard/verilog/fpga/memory_fault.sv +40 -0
- switchboard/verilog/fpga/sb_fpga_queues.sv +416 -0
- switchboard/verilog/fpga/sb_rx_fpga.sv +303 -0
- switchboard/verilog/fpga/sb_tx_fpga.sv +294 -0
- switchboard/verilog/fpga/umi_fpga_queues.sv +146 -0
- switchboard/verilog/sim/__init__.py +0 -0
- switchboard/verilog/sim/auto_stop_sim.sv +25 -0
- switchboard/verilog/sim/perf_meas_sim.sv +97 -0
- switchboard/verilog/sim/queue_to_sb_sim.sv +176 -0
- switchboard/verilog/sim/queue_to_umi_sim.sv +66 -0
- switchboard/verilog/sim/sb_apb_m.sv +146 -0
- switchboard/verilog/sim/sb_axi_m.sv +199 -0
- switchboard/verilog/sim/sb_axil_m.sv +180 -0
- switchboard/verilog/sim/sb_axil_s.sv +180 -0
- switchboard/verilog/sim/sb_clk_gen.sv +89 -0
- switchboard/verilog/sim/sb_jtag_rbb_sim.sv +148 -0
- switchboard/verilog/sim/sb_rx_sim.sv +55 -0
- switchboard/verilog/sim/sb_to_queue_sim.sv +196 -0
- switchboard/verilog/sim/sb_tx_sim.sv +55 -0
- switchboard/verilog/sim/switchboard_sim.py +49 -0
- switchboard/verilog/sim/umi_rx_sim.sv +61 -0
- switchboard/verilog/sim/umi_to_queue_sim.sv +66 -0
- switchboard/verilog/sim/umi_tx_sim.sv +61 -0
- switchboard/verilog/sim/xyce_intf.sv +67 -0
- switchboard/vpi/switchboard_vpi.cc +431 -0
- switchboard/vpi/xyce_vpi.cc +200 -0
- switchboard/warn.py +14 -0
- switchboard/xyce.py +27 -0
- switchboard_hw-0.3.0.dist-info/METADATA +303 -0
- switchboard_hw-0.3.0.dist-info/RECORD +99 -0
- switchboard_hw-0.3.0.dist-info/WHEEL +6 -0
- switchboard_hw-0.3.0.dist-info/entry_points.txt +6 -0
- switchboard_hw-0.3.0.dist-info/licenses/LICENSE +190 -0
- switchboard_hw-0.3.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// sb_to_queue_sim
|
|
2
|
+
|
|
3
|
+
// ready_mode settings (in all cases, ready remains low if an outbound packet is stuck)
|
|
4
|
+
// ready_mode=0: ready waits for valid before asserting
|
|
5
|
+
// ready_mode=1: ready remains asserted as long as an outbound packet is not stuck
|
|
6
|
+
// ready_mode=2: ready toggles randomly as long as an outbound packet is not stuck
|
|
7
|
+
|
|
8
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
9
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
10
|
+
|
|
11
|
+
`default_nettype none
|
|
12
|
+
|
|
13
|
+
module sb_to_queue_sim #(
|
|
14
|
+
parameter integer READY_MODE_DEFAULT=0,
|
|
15
|
+
parameter integer DW=416,
|
|
16
|
+
parameter FILE=""
|
|
17
|
+
) (
|
|
18
|
+
input clk,
|
|
19
|
+
input reset,
|
|
20
|
+
input [DW-1:0] data,
|
|
21
|
+
input [31:0] dest,
|
|
22
|
+
input last,
|
|
23
|
+
output reg ready=1'b0,
|
|
24
|
+
input valid
|
|
25
|
+
);
|
|
26
|
+
// SBDW value corresponds to UMI DW=256
|
|
27
|
+
// 32b (cmd) + 64b (srcaddr) + 64b (dstaddr) + 256b = 416b
|
|
28
|
+
|
|
29
|
+
// SBDW must be a multiple of 32 (constrained by VPI driver,
|
|
30
|
+
// which transfers data in 32-bit chunks)
|
|
31
|
+
|
|
32
|
+
localparam SBDW = 416;
|
|
33
|
+
|
|
34
|
+
`ifdef __ICARUS__
|
|
35
|
+
`define SB_EXT_FUNC(x) $``x``
|
|
36
|
+
`define SB_START_FUNC task
|
|
37
|
+
`define SB_END_FUNC endtask
|
|
38
|
+
`else
|
|
39
|
+
`define SB_EXT_FUNC(x) x
|
|
40
|
+
`define SB_START_FUNC function void
|
|
41
|
+
`define SB_END_FUNC endfunction
|
|
42
|
+
|
|
43
|
+
import "DPI-C" function void pi_sb_tx_init (output int id,
|
|
44
|
+
input string uri, input int width);
|
|
45
|
+
import "DPI-C" function void pi_sb_send (input int id, input bit [SBDW-1:0] sdata,
|
|
46
|
+
input bit [31:0] sdest, input bit slast, output int success);
|
|
47
|
+
`endif
|
|
48
|
+
|
|
49
|
+
// internal signals
|
|
50
|
+
|
|
51
|
+
integer id = -1;
|
|
52
|
+
|
|
53
|
+
`SB_START_FUNC init(input string uri);
|
|
54
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
55
|
+
`SB_EXT_FUNC(pi_sb_tx_init)(id, uri, (DW + 7)/8);
|
|
56
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
57
|
+
`SB_END_FUNC
|
|
58
|
+
|
|
59
|
+
integer success = 0;
|
|
60
|
+
reg pending = 1'b0;
|
|
61
|
+
|
|
62
|
+
wire [SBDW-1:0] data_padded;
|
|
63
|
+
generate
|
|
64
|
+
if (SBDW > DW) begin
|
|
65
|
+
assign data_padded = {{(SBDW-DW){1'b0}}, data};
|
|
66
|
+
end else begin
|
|
67
|
+
assign data_padded = data;
|
|
68
|
+
end
|
|
69
|
+
endgenerate
|
|
70
|
+
|
|
71
|
+
reg [SBDW-1:0] sdata = 'b0;
|
|
72
|
+
reg [31:0] sdest = 32'b0;
|
|
73
|
+
reg slast = 1'b0;
|
|
74
|
+
|
|
75
|
+
// ready mode
|
|
76
|
+
|
|
77
|
+
integer ready_mode = READY_MODE_DEFAULT;
|
|
78
|
+
|
|
79
|
+
`SB_START_FUNC set_ready_mode(input integer value);
|
|
80
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
81
|
+
ready_mode = value;
|
|
82
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
83
|
+
`SB_END_FUNC
|
|
84
|
+
|
|
85
|
+
// main logic
|
|
86
|
+
|
|
87
|
+
always @(posedge clk or posedge reset) begin
|
|
88
|
+
if (reset) begin
|
|
89
|
+
pending <= 1'b0;
|
|
90
|
+
ready <= 1'b0;
|
|
91
|
+
slast <= 1'b0;
|
|
92
|
+
end else begin
|
|
93
|
+
if (ready && valid) begin
|
|
94
|
+
// try to send a packet, with success==1 indicating that the
|
|
95
|
+
// send was successful. in general, sends should succeed,
|
|
96
|
+
// unless the queue they're trying to push to is full.
|
|
97
|
+
if (id != -1) begin
|
|
98
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
99
|
+
`SB_EXT_FUNC(pi_sb_send)(id, data_padded, dest, last, success);
|
|
100
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
101
|
+
end else begin
|
|
102
|
+
/* verilator lint_off BLKSEQ */
|
|
103
|
+
success = 32'd0;
|
|
104
|
+
/* verilator lint_on BLKSEQ */
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
// if the send was not successful, mark it pending. ready cannot be asserted
|
|
108
|
+
// if there is a pending re-send, since the next send may fail, and there
|
|
109
|
+
// would be no place to store the data for the new resend. we could have a
|
|
110
|
+
// queue, but that would have finite depth, so we would still have to be able
|
|
111
|
+
// to apply backpressure.
|
|
112
|
+
if (success == 32'd0) begin
|
|
113
|
+
pending <= 1'b1;
|
|
114
|
+
ready <= 1'b0;
|
|
115
|
+
sdata <= data_padded;
|
|
116
|
+
sdest <= dest;
|
|
117
|
+
slast <= last;
|
|
118
|
+
end else begin
|
|
119
|
+
pending <= 1'b0;
|
|
120
|
+
if (ready_mode == 32'd0) begin
|
|
121
|
+
ready <= 1'b0;
|
|
122
|
+
end else if (ready_mode == 32'd1) begin
|
|
123
|
+
ready <= 1'b1;
|
|
124
|
+
end else begin
|
|
125
|
+
/* verilator lint_off WIDTH */
|
|
126
|
+
ready <= ($random % 2);
|
|
127
|
+
/* verilator lint_on WIDTH */
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end else if (pending) begin
|
|
131
|
+
// try to re-send a packet. note that in a given cycle, a packet can be sent
|
|
132
|
+
// for the first time or re-sent, but not both, because ready cannot be asserted
|
|
133
|
+
// if there is a packet pending, for the reason given above.
|
|
134
|
+
if (id != -1) begin
|
|
135
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
136
|
+
`SB_EXT_FUNC(pi_sb_send)(id, sdata, sdest, slast, success);
|
|
137
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
138
|
+
end else begin
|
|
139
|
+
/* verilator lint_off BLKSEQ */
|
|
140
|
+
success = 32'd0;
|
|
141
|
+
/* verilator lint_on BLKSEQ */
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
// if the re-send was unsuccessful, we have to keep ready de-asserted,
|
|
145
|
+
// but if it was successful we can assert ready if we want to,
|
|
146
|
+
// depending on ready_mode
|
|
147
|
+
if (success == 32'd0) begin
|
|
148
|
+
pending <= 1'b1;
|
|
149
|
+
ready <= 1'b0;
|
|
150
|
+
end else begin
|
|
151
|
+
pending <= 1'b0;
|
|
152
|
+
if (ready_mode == 32'd0) begin
|
|
153
|
+
ready <= 1'b0;
|
|
154
|
+
end else if (ready_mode == 32'd1) begin
|
|
155
|
+
ready <= 1'b1;
|
|
156
|
+
end else begin
|
|
157
|
+
/* verilator lint_off WIDTH */
|
|
158
|
+
ready <= ($random % 2);
|
|
159
|
+
/* verilator lint_on WIDTH */
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end else begin
|
|
163
|
+
// if there's nothing pending, then we can assert ready
|
|
164
|
+
// if we want to. whether we do or not depends on ready_mode.
|
|
165
|
+
if (ready_mode == 32'd0) begin
|
|
166
|
+
ready <= valid;
|
|
167
|
+
end else if (ready_mode == 32'd1) begin
|
|
168
|
+
ready <= 1'b1;
|
|
169
|
+
end else begin
|
|
170
|
+
/* verilator lint_off WIDTH */
|
|
171
|
+
ready <= ($random % 2);
|
|
172
|
+
/* verilator lint_on WIDTH */
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
// initialize
|
|
179
|
+
|
|
180
|
+
initial begin
|
|
181
|
+
if (FILE != "") begin
|
|
182
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
183
|
+
init(FILE);
|
|
184
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
// clean up macros
|
|
189
|
+
|
|
190
|
+
`undef SB_EXT_FUNC
|
|
191
|
+
`undef SB_START_FUNC
|
|
192
|
+
`undef SB_END_FUNC
|
|
193
|
+
|
|
194
|
+
endmodule
|
|
195
|
+
|
|
196
|
+
`default_nettype wire
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Wrapper module for backwards compatibility (will eventually be removed)
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
4
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
5
|
+
|
|
6
|
+
`default_nettype none
|
|
7
|
+
|
|
8
|
+
module sb_tx_sim #(
|
|
9
|
+
parameter integer READY_MODE_DEFAULT=0,
|
|
10
|
+
parameter integer DW=416,
|
|
11
|
+
parameter FILE=""
|
|
12
|
+
) (
|
|
13
|
+
input clk,
|
|
14
|
+
input [DW-1:0] data,
|
|
15
|
+
input [31:0] dest,
|
|
16
|
+
input last,
|
|
17
|
+
output ready,
|
|
18
|
+
input valid
|
|
19
|
+
);
|
|
20
|
+
`ifdef __ICARUS__
|
|
21
|
+
`define SB_START_FUNC task
|
|
22
|
+
`define SB_END_FUNC endtask
|
|
23
|
+
`else
|
|
24
|
+
`define SB_START_FUNC function void
|
|
25
|
+
`define SB_END_FUNC endfunction
|
|
26
|
+
`endif
|
|
27
|
+
|
|
28
|
+
sb_to_queue_sim #(
|
|
29
|
+
.READY_MODE_DEFAULT(READY_MODE_DEFAULT),
|
|
30
|
+
.DW(DW),
|
|
31
|
+
.FILE(FILE)
|
|
32
|
+
) tx_i (
|
|
33
|
+
.*
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
`SB_START_FUNC init(input string uri);
|
|
37
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
38
|
+
tx_i.init(uri);
|
|
39
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
40
|
+
`SB_END_FUNC
|
|
41
|
+
|
|
42
|
+
`SB_START_FUNC set_ready_mode(input integer value);
|
|
43
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
44
|
+
tx_i.set_ready_mode(value);
|
|
45
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
46
|
+
`SB_END_FUNC
|
|
47
|
+
|
|
48
|
+
// clean up macros
|
|
49
|
+
|
|
50
|
+
`undef SB_START_FUNC
|
|
51
|
+
`undef SB_END_FUNC
|
|
52
|
+
|
|
53
|
+
endmodule
|
|
54
|
+
|
|
55
|
+
`default_nettype wire
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from siliconcompiler import Design
|
|
2
|
+
|
|
3
|
+
from switchboard.verilator.verilator import Verilator
|
|
4
|
+
from switchboard.dpi.switchboard_dpi import SwitchboardDPI
|
|
5
|
+
from switchboard.verilog.common.common import Common
|
|
6
|
+
from switchboard import sb_path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SwitchboardSim(Design):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__("sb_sim")
|
|
12
|
+
|
|
13
|
+
files = [
|
|
14
|
+
"auto_stop_sim.sv",
|
|
15
|
+
"perf_meas_sim.sv",
|
|
16
|
+
"queue_to_sb_sim.sv",
|
|
17
|
+
"queue_to_umi_sim.sv",
|
|
18
|
+
"sb_axil_m.sv",
|
|
19
|
+
"sb_axi_m.sv",
|
|
20
|
+
"sb_jtag_rbb_sim.sv",
|
|
21
|
+
"sb_to_queue_sim.sv",
|
|
22
|
+
"umi_to_queue_sim.sv",
|
|
23
|
+
"sb_axil_s.sv",
|
|
24
|
+
"sb_clk_gen.sv",
|
|
25
|
+
"sb_rx_sim.sv",
|
|
26
|
+
"sb_tx_sim.sv",
|
|
27
|
+
"umi_rx_sim.sv",
|
|
28
|
+
"umi_tx_sim.sv",
|
|
29
|
+
"xyce_intf.sv",
|
|
30
|
+
"sb_apb_m.sv"
|
|
31
|
+
]
|
|
32
|
+
deps = [Common()]
|
|
33
|
+
|
|
34
|
+
self.set_dataroot("sb_verilog_sim", sb_path() / "verilog" / "sim")
|
|
35
|
+
|
|
36
|
+
with self.active_fileset("rtl"):
|
|
37
|
+
for item in files:
|
|
38
|
+
self.add_file(item)
|
|
39
|
+
for item in deps:
|
|
40
|
+
self.add_depfileset(item)
|
|
41
|
+
|
|
42
|
+
with self.active_fileset("verilator"):
|
|
43
|
+
self.add_depfileset(self, "rtl")
|
|
44
|
+
self.add_depfileset(Verilator())
|
|
45
|
+
self.add_depfileset(SwitchboardDPI())
|
|
46
|
+
|
|
47
|
+
with self.active_fileset("icarus"):
|
|
48
|
+
self.add_depfileset(self, "rtl")
|
|
49
|
+
self.add_define("__ICARUS__")
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Wrapper module for backwards compatibility (will eventually be removed)
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
4
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
5
|
+
|
|
6
|
+
`default_nettype none
|
|
7
|
+
|
|
8
|
+
module umi_rx_sim #(
|
|
9
|
+
parameter integer VALID_MODE_DEFAULT=0,
|
|
10
|
+
parameter integer DW=256,
|
|
11
|
+
parameter integer AW=64,
|
|
12
|
+
parameter integer CW=32,
|
|
13
|
+
parameter FILE=""
|
|
14
|
+
) (
|
|
15
|
+
input clk,
|
|
16
|
+
output [DW-1:0] data,
|
|
17
|
+
output [AW-1:0] srcaddr,
|
|
18
|
+
output [AW-1:0] dstaddr,
|
|
19
|
+
output [CW-1:0] cmd,
|
|
20
|
+
input ready,
|
|
21
|
+
output valid
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
`ifdef __ICARUS__
|
|
25
|
+
`define SB_START_FUNC task
|
|
26
|
+
`define SB_END_FUNC endtask
|
|
27
|
+
`else
|
|
28
|
+
`define SB_START_FUNC function void
|
|
29
|
+
`define SB_END_FUNC endfunction
|
|
30
|
+
`endif
|
|
31
|
+
|
|
32
|
+
queue_to_umi_sim #(
|
|
33
|
+
.VALID_MODE_DEFAULT(VALID_MODE_DEFAULT),
|
|
34
|
+
.DW(DW),
|
|
35
|
+
.AW(AW),
|
|
36
|
+
.CW(CW),
|
|
37
|
+
.FILE(FILE)
|
|
38
|
+
) rx_i (
|
|
39
|
+
.*
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
`SB_START_FUNC init(input string uri);
|
|
43
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
44
|
+
rx_i.init(uri);
|
|
45
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
46
|
+
`SB_END_FUNC
|
|
47
|
+
|
|
48
|
+
`SB_START_FUNC set_valid_mode(input integer value);
|
|
49
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
50
|
+
rx_i.set_valid_mode(value);
|
|
51
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
52
|
+
`SB_END_FUNC
|
|
53
|
+
|
|
54
|
+
// clean up macros
|
|
55
|
+
|
|
56
|
+
`undef SB_START_FUNC
|
|
57
|
+
`undef SB_END_FUNC
|
|
58
|
+
|
|
59
|
+
endmodule
|
|
60
|
+
|
|
61
|
+
`default_nettype wire
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
2
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
3
|
+
|
|
4
|
+
`default_nettype none
|
|
5
|
+
|
|
6
|
+
module umi_to_queue_sim #(
|
|
7
|
+
parameter integer READY_MODE_DEFAULT=0,
|
|
8
|
+
parameter integer DW=256,
|
|
9
|
+
parameter integer AW=64,
|
|
10
|
+
parameter integer CW=32,
|
|
11
|
+
parameter FILE=""
|
|
12
|
+
) (
|
|
13
|
+
input clk,
|
|
14
|
+
input reset,
|
|
15
|
+
input [DW-1:0] data,
|
|
16
|
+
input [AW-1:0] srcaddr,
|
|
17
|
+
input [AW-1:0] dstaddr,
|
|
18
|
+
input [CW-1:0] cmd,
|
|
19
|
+
output ready,
|
|
20
|
+
input valid
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
sb_to_queue_sim #(
|
|
24
|
+
.READY_MODE_DEFAULT(READY_MODE_DEFAULT),
|
|
25
|
+
.DW(DW+AW+AW+CW),
|
|
26
|
+
.FILE(FILE)
|
|
27
|
+
) tx_i (
|
|
28
|
+
.clk(clk),
|
|
29
|
+
.reset(reset),
|
|
30
|
+
.data({data, srcaddr, dstaddr, cmd}),
|
|
31
|
+
.dest({16'h0000, dstaddr[55:40]}),
|
|
32
|
+
.last(cmd[22]),
|
|
33
|
+
.ready(ready),
|
|
34
|
+
.valid(valid)
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// handle differences between simulators
|
|
38
|
+
|
|
39
|
+
`ifdef __ICARUS__
|
|
40
|
+
`define SB_START_FUNC task
|
|
41
|
+
`define SB_END_FUNC endtask
|
|
42
|
+
`else
|
|
43
|
+
`define SB_START_FUNC function void
|
|
44
|
+
`define SB_END_FUNC endfunction
|
|
45
|
+
`endif
|
|
46
|
+
|
|
47
|
+
`SB_START_FUNC init(input string uri);
|
|
48
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
49
|
+
tx_i.init(uri);
|
|
50
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
51
|
+
`SB_END_FUNC
|
|
52
|
+
|
|
53
|
+
`SB_START_FUNC set_ready_mode(input integer value);
|
|
54
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
55
|
+
tx_i.set_ready_mode(value);
|
|
56
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
57
|
+
`SB_END_FUNC
|
|
58
|
+
|
|
59
|
+
// clean up macros
|
|
60
|
+
|
|
61
|
+
`undef SB_START_FUNC
|
|
62
|
+
`undef SB_END_FUNC
|
|
63
|
+
|
|
64
|
+
endmodule
|
|
65
|
+
|
|
66
|
+
`default_nettype wire
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Wrapper module for backwards compatibility (will eventually be removed)
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
4
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
5
|
+
|
|
6
|
+
`default_nettype none
|
|
7
|
+
|
|
8
|
+
module umi_tx_sim #(
|
|
9
|
+
parameter integer READY_MODE_DEFAULT=0,
|
|
10
|
+
parameter integer DW=256,
|
|
11
|
+
parameter integer AW=64,
|
|
12
|
+
parameter integer CW=32,
|
|
13
|
+
parameter FILE=""
|
|
14
|
+
) (
|
|
15
|
+
input clk,
|
|
16
|
+
input [DW-1:0] data,
|
|
17
|
+
input [AW-1:0] srcaddr,
|
|
18
|
+
input [AW-1:0] dstaddr,
|
|
19
|
+
input [CW-1:0] cmd,
|
|
20
|
+
output ready,
|
|
21
|
+
input valid
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
`ifdef __ICARUS__
|
|
25
|
+
`define SB_START_FUNC task
|
|
26
|
+
`define SB_END_FUNC endtask
|
|
27
|
+
`else
|
|
28
|
+
`define SB_START_FUNC function void
|
|
29
|
+
`define SB_END_FUNC endfunction
|
|
30
|
+
`endif
|
|
31
|
+
|
|
32
|
+
umi_to_queue_sim #(
|
|
33
|
+
.READY_MODE_DEFAULT(READY_MODE_DEFAULT),
|
|
34
|
+
.DW(DW),
|
|
35
|
+
.AW(AW),
|
|
36
|
+
.CW(CW),
|
|
37
|
+
.FILE(FILE)
|
|
38
|
+
) tx_i (
|
|
39
|
+
.*
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
`SB_START_FUNC init(input string uri);
|
|
43
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
44
|
+
tx_i.init(uri);
|
|
45
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
46
|
+
`SB_END_FUNC
|
|
47
|
+
|
|
48
|
+
`SB_START_FUNC set_ready_mode(input integer value);
|
|
49
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
50
|
+
tx_i.set_ready_mode(value);
|
|
51
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
52
|
+
`SB_END_FUNC
|
|
53
|
+
|
|
54
|
+
// clean up macros
|
|
55
|
+
|
|
56
|
+
`undef SB_START_FUNC
|
|
57
|
+
`undef SB_END_FUNC
|
|
58
|
+
|
|
59
|
+
endmodule
|
|
60
|
+
|
|
61
|
+
`default_nettype wire
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Module for interfacing with Xyce analog simulation
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 Zero ASIC Corporation
|
|
4
|
+
// This code is licensed under Apache License 2.0 (see LICENSE for details)
|
|
5
|
+
|
|
6
|
+
module xyce_intf;
|
|
7
|
+
timeprecision 1fs;
|
|
8
|
+
|
|
9
|
+
`ifdef __ICARUS__
|
|
10
|
+
`define SB_EXT_FUNC(x) $``x``
|
|
11
|
+
`define SB_START_FUNC task
|
|
12
|
+
`define SB_END_FUNC endtask
|
|
13
|
+
|
|
14
|
+
timeunit 1s;
|
|
15
|
+
`define SB_ABSTIME ($realtime)
|
|
16
|
+
`else
|
|
17
|
+
`define SB_EXT_FUNC(x) x
|
|
18
|
+
`define SB_START_FUNC function void
|
|
19
|
+
`define SB_END_FUNC endfunction
|
|
20
|
+
`define SB_ABSTIME ($realtime/1s)
|
|
21
|
+
|
|
22
|
+
import "DPI-C" function void pi_sb_xyce_init (
|
|
23
|
+
output int id,
|
|
24
|
+
input string file
|
|
25
|
+
);
|
|
26
|
+
import "DPI-C" function void pi_sb_xyce_put (
|
|
27
|
+
input int id,
|
|
28
|
+
input string name,
|
|
29
|
+
input real t,
|
|
30
|
+
input real value
|
|
31
|
+
);
|
|
32
|
+
import "DPI-C" function void pi_sb_xyce_get (
|
|
33
|
+
input int id,
|
|
34
|
+
input string name,
|
|
35
|
+
input real t,
|
|
36
|
+
output real value
|
|
37
|
+
);
|
|
38
|
+
`endif
|
|
39
|
+
|
|
40
|
+
integer id = -1;
|
|
41
|
+
|
|
42
|
+
`SB_START_FUNC init(input string file);
|
|
43
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
44
|
+
`SB_EXT_FUNC(pi_sb_xyce_init)(id, file);
|
|
45
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
46
|
+
`SB_END_FUNC
|
|
47
|
+
|
|
48
|
+
`SB_START_FUNC put(input string name, input real value);
|
|
49
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
50
|
+
`SB_EXT_FUNC(pi_sb_xyce_put)(id, name, `SB_ABSTIME, value);
|
|
51
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
52
|
+
`SB_END_FUNC
|
|
53
|
+
|
|
54
|
+
`SB_START_FUNC get(input string name, output real value);
|
|
55
|
+
/* verilator lint_off IGNOREDRETURN */
|
|
56
|
+
`SB_EXT_FUNC(pi_sb_xyce_get)(id, name, `SB_ABSTIME, value);
|
|
57
|
+
/* verilator lint_on IGNOREDRETURN */
|
|
58
|
+
`SB_END_FUNC
|
|
59
|
+
|
|
60
|
+
// clean up macros
|
|
61
|
+
|
|
62
|
+
`undef SB_EXT_FUNC
|
|
63
|
+
`undef SB_START_FUNC
|
|
64
|
+
`undef SB_END_FUNC
|
|
65
|
+
`undef SB_ABSTIME
|
|
66
|
+
|
|
67
|
+
endmodule
|