Skip to content

Commit 1439a77

Browse files
authored
Merge pull request #210 from pulp-platform/fix-cdc-vcs-port-mismatches
axi_cdc: Improve compatibility with VCS
2 parents 0864456 + 8dfb1c8 commit 1439a77

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
### Changed
1414

1515
### Fixed
16+
- `axi_cdc`: Improve compatibility with VCS by restricting a QuestaSim workaround to be used only
17+
for QuestaSim (issue #207).
1618
- `axi_id_remap`: Improve compatibility with Verilator by excluding `assert`s for that tool.
1719
- `axi_lite_demux`: Improve compatibility with VCS (issue #187 reported for `axi_demux`, which was
1820
fixed in v0.29.2).

src/axi_cdc_dst.sv

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ module axi_cdc_dst #(
5858
);
5959

6060
cdc_fifo_gray_dst #(
61+
`ifdef QUESTA
62+
// Workaround for a bug in Questa: Pass flat logic vector instead of struct to type parameter.
6163
.T ( logic [$bits(aw_chan_t)-1:0] ),
64+
`else
65+
// Other tools, such as VCS, have problems with type parameters constructed through `$bits()`.
66+
.T ( aw_chan_t ),
67+
`endif
6268
.LOG_DEPTH ( LogDepth )
6369
) i_cdc_fifo_gray_dst_aw (
6470
.async_data_i ( async_data_slave_aw_data_i ),
@@ -72,7 +78,11 @@ module axi_cdc_dst #(
7278
);
7379

7480
cdc_fifo_gray_dst #(
81+
`ifdef QUESTA
7582
.T ( logic [$bits(w_chan_t)-1:0] ),
83+
`else
84+
.T ( w_chan_t ),
85+
`endif
7686
.LOG_DEPTH ( LogDepth )
7787
) i_cdc_fifo_gray_dst_w (
7888
.async_data_i ( async_data_slave_w_data_i ),
@@ -86,7 +96,11 @@ module axi_cdc_dst #(
8696
);
8797

8898
cdc_fifo_gray_src #(
99+
`ifdef QUESTA
89100
.T ( logic [$bits(b_chan_t)-1:0] ),
101+
`else
102+
.T ( b_chan_t ),
103+
`endif
90104
.LOG_DEPTH ( LogDepth )
91105
) i_cdc_fifo_gray_src_b (
92106
.src_clk_i ( dst_clk_i ),
@@ -100,7 +114,11 @@ module axi_cdc_dst #(
100114
);
101115

102116
cdc_fifo_gray_dst #(
117+
`ifdef QUESTA
103118
.T ( logic [$bits(ar_chan_t)-1:0] ),
119+
`else
120+
.T ( ar_chan_t ),
121+
`endif
104122
.LOG_DEPTH ( LogDepth )
105123
) i_cdc_fifo_gray_dst_ar (
106124
.dst_clk_i,
@@ -114,7 +132,11 @@ module axi_cdc_dst #(
114132
);
115133

116134
cdc_fifo_gray_src #(
135+
`ifdef QUESTA
117136
.T ( logic [$bits(r_chan_t)-1:0] ),
137+
`else
138+
.T ( r_chan_t ),
139+
`endif
118140
.LOG_DEPTH ( LogDepth )
119141
) i_cdc_fifo_gray_src_r (
120142
.src_clk_i ( dst_clk_i ),

src/axi_cdc_src.sv

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ module axi_cdc_src #(
5858
);
5959

6060
cdc_fifo_gray_src #(
61+
// Workaround for a bug in Questa (see comment in `axi_cdc_dst` for details).
62+
`ifdef QUESTA
6163
.T ( logic [$bits(aw_chan_t)-1:0] ),
64+
`else
65+
.T ( aw_chan_t ),
66+
`endif
6267
.LOG_DEPTH ( LogDepth )
6368
) i_cdc_fifo_gray_src_aw (
6469
.src_clk_i,
@@ -72,7 +77,11 @@ module axi_cdc_src #(
7277
);
7378

7479
cdc_fifo_gray_src #(
80+
`ifdef QUESTA
7581
.T ( logic [$bits(w_chan_t)-1:0] ),
82+
`else
83+
.T ( w_chan_t ),
84+
`endif
7685
.LOG_DEPTH ( LogDepth )
7786
) i_cdc_fifo_gray_src_w (
7887
.src_clk_i,
@@ -86,7 +95,11 @@ module axi_cdc_src #(
8695
);
8796

8897
cdc_fifo_gray_dst #(
98+
`ifdef QUESTA
8999
.T ( logic [$bits(b_chan_t)-1:0] ),
100+
`else
101+
.T ( b_chan_t ),
102+
`endif
90103
.LOG_DEPTH ( LogDepth )
91104
) i_cdc_fifo_gray_dst_b (
92105
.dst_clk_i ( src_clk_i ),
@@ -100,7 +113,11 @@ module axi_cdc_src #(
100113
);
101114

102115
cdc_fifo_gray_src #(
116+
`ifdef QUESTA
103117
.T ( logic [$bits(ar_chan_t)-1:0] ),
118+
`else
119+
.T ( ar_chan_t ),
120+
`endif
104121
.LOG_DEPTH ( LogDepth )
105122
) i_cdc_fifo_gray_src_ar (
106123
.src_clk_i,
@@ -114,7 +131,11 @@ module axi_cdc_src #(
114131
);
115132

116133
cdc_fifo_gray_dst #(
134+
`ifdef QUESTA
117135
.T ( logic [$bits(r_chan_t)-1:0] ),
136+
`else
137+
.T ( r_chan_t ),
138+
`endif
118139
.LOG_DEPTH ( LogDepth )
119140
) i_cdc_fifo_gray_dst_r (
120141
.dst_clk_i ( src_clk_i ),

0 commit comments

Comments
 (0)