feature_env_setup.tcl 12.9 KB
Newer Older
1
################################################################################
Martin Jeřábek's avatar
Martin Jeřábek committed
2 3 4
##
## CAN with Flexible Data-Rate IP Core
##
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
5
## Copyright (C) 2017 Ondrej Ille <ondrej.ille@gmail.com>
Martin Jeřábek's avatar
Martin Jeřábek committed
6
##
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
7 8 9 10
## Project advisor: Jiri Novak <jnovak@fel.cvut.cz>
## Department of Measurement         (http://meas.fel.cvut.cz/)
## Faculty of Electrical Engineering (http://www.fel.cvut.cz)
## Czech Technical University        (http://www.cvut.cz/)
Martin Jeřábek's avatar
Martin Jeřábek committed
11 12 13 14 15 16
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this VHDL component and associated documentation files (the "Component"),
## to deal in the Component without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and/or sell copies of the Component, and to permit persons to whom the
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
17
## Component is furnished to do so, subject to the following conditions:
Martin Jeřábek's avatar
Martin Jeřábek committed
18 19
##
## The above copyright notice and this permission notice shall be included in
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
20
## all copies or substantial portions of the Component.
Martin Jeřábek's avatar
Martin Jeřábek committed
21 22 23 24 25
##
## THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Martin Jeřábek's avatar
Martin Jeřábek committed
27
## FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
28
## IN THE COMPONENT.
Martin Jeřábek's avatar
Martin Jeřábek committed
29 30 31
##
## The CAN protocol is developed by Robert Bosch GmbH and protected by patents.
## Anybody who wants to implement this IP core on silicon has to obtain a CAN
32
## protocol license from Bosch.
Martin Jeřábek's avatar
Martin Jeřábek committed
33
##
34 35 36
################################################################################

################################################################################
37 38 39 40 41
## Description:
## 			Feature environment waveform setup script
################################################################################
global TCOMP
global INST1
42 43
global SIG1
global SIG2
44 45 46
global CORE

start_CAN_simulation "feature_env_test_wrapper"
47 48 49
quietly set INST1 "g_inst(1)/can_inst"
quietly set SIG1 "p(1)"
quietly set SIG2 "p(2)"
50 51 52 53 54 55 56 57 58 59 60 61 62 63
quietly set CORE  "core_top_comp"

################################################################################
# Adding the waves
################################################################################

#Add common waves for each test entity
add_test_status_waves
add wave error_ctr
add wave -label "Name of test" $TCOMP/test_name

#Add circuit specific signals

add wave -noupdate -divider -height 20 "System and CAN bus"
64 65 66 67 68 69
add wave -label "Node 1 clock" $TCOMP/$SIG1.clk_sys
add wave -label "Node 2 clock" $TCOMP/$SIG2.clk_sys
add wave -label "Node 1 reset" $TCOMP/$SIG1.res_n
add wave -label "Node 2 reset" $TCOMP/$SIG2.res_n
add wave -label "Timestamp 1" $TCOMP/$SIG1.timestamp
add wave -label "Timestamp 2" $TCOMP/$SIG2.timestamp
70 71 72 73 74
add wave -label "Bus level" $TCOMP/bus_level
add wave -label "Inject to bus" $TCOMP/bl_force
add wave -label "Value to inject" $TCOMP/bl_inject


Martin Jeřábek's avatar
Martin Jeřábek committed
75
add wave -noupdate -divider -height 20 "Node 1"
76

77 78 79 80 81
add wave -label "Memory bus" "$TCOMP/mem_bus(1)"
add wave -label "CAN_TX" $TCOMP/$SIG1.can_tx
add wave -label "CAN_RX" $TCOMP/$SIG1.can_rx
add wave -label "Interrupt" $TCOMP/$SIG1.int
add wave -label "Transceiver delay" $TCOMP/$SIG1.tr_del
82 83
add wave -label "Driving bus" $TCOMP/$INST1/drv_bus
add wave -label "Status bus" $TCOMP/$INST1/stat_bus
Martin Jeřábek's avatar
Martin Jeřábek committed
84

85 86 87 88 89 90 91 92 93 94 95
add wave -group "RX Buffer (1)" \
	-label "RX_DATA" $TCOMP/$INST1/rx_read_buff \
	-label "Buffer size" -unsigned $TCOMP/$INST1/rx_buf_size \
	-label "Full" $TCOMP/$INST1/rx_full \
	-label "Empty" $TCOMP/$INST1/rx_empty \
	-label "Frames stored" -unsigned $TCOMP/$INST1/rx_message_count \
	-label "Free words" -unsigned $TCOMP/$INST1/rx_mem_free \
	-label "Read pointer" -unsigned $TCOMP/$INST1/rx_read_pointer_pos \
	-label "Write pointer" -unsigned $TCOMP/$INST1/rx_write_pointer_pos \
	-label "Data overrun" -unsigned $TCOMP/$INST1/rx_data_overrun

96 97 98
add wave -group "TXT Buffers (1)" \
	-label "FSM States" $TCOMP/$INST1/txtb_fsms

99 100 101 102 103
add wave -group "Interrupt manager (1)" \
	-label "Interrupt vector" $TCOMP/$INST1/int_vector \
	-label "Interrupt enable" $TCOMP/$INST1/int_ena \
	-label "Interrupt mask" $TCOMP/$INST1/int_mask

104 105 106 107 108 109 110 111
add wave -group "Frame to transmit (1)" \
	-label "Frame is valid" $TCOMP/$INST1/tran_frame_valid_out \
	-label "data" -hexadecimal $TCOMP/$INST1/tran_data_out \
	-label "DLC" $TCOMP/$INST1/tran_dlc_out \
	-label "RTR" $TCOMP/$INST1/tran_is_rtr \
	-label "Identifier type" $TCOMP/$INST1/tran_ident_type_out \
	-label "Frame format" $TCOMP/$INST1/tran_frame_type_out \
	-label "BRS" $TCOMP/$INST1/tran_brs_out
Martin Jeřábek's avatar
Martin Jeřábek committed
112

113 114
add wave -group "Frame to recieve (1)" \
	-label "Frame is valid" $TCOMP/$INST1/rec_message_valid \
115 116
	-label "Data word" -hexadecimal $TCOMP/$INST1/rx_store_data_word \
	-label "Store Data word" -hexadecimal $TCOMP/$INST1/rx_store_data \
117 118 119 120 121 122 123
	-label "identifier" $TCOMP/$INST1/rec_ident_in \
	-label "DLC" $TCOMP/$INST1/rec_dlc_in \
	-label "RTR" $TCOMP/$INST1/rec_is_rtr \
	-label "Identifier type" $TCOMP/$INST1/rec_ident_type_in \
	-label "Frame format" $TCOMP/$INST1/rec_frame_type_in \
	-label "BRS" $TCOMP/$INST1/rec_brs \
	-label "ESI" $TCOMP/$INST1/rec_esi
Martin Jeřábek's avatar
Martin Jeřábek committed
124

125 126 127 128 129 130 131 132 133 134 135
add wave -group "Prescaler (1)" \
	-label "Time quantum (Nominal)" $TCOMP/$INST1/clk_tq_nbt \
	-label "Time quantum (Data)" $TCOMP/$INST1/clk_tq_dbt \
	-label "Sync (Nominal)" $TCOMP/$INST1/sync_nbt \
	-label "Sync (Data)" $TCOMP/$INST1/sync_dbt \
	-label "Sample (Nominal)" $TCOMP/$INST1/sample_nbt \
	-label "Sample (Data)" $TCOMP/$INST1/sample_dbt \
	-label "Sample type" $TCOMP/$INST1/sp_control \
	-label "Synchronization type" $TCOMP/$INST1/sync_control \
	-label "Bit time state" $TCOMP/$INST1/bt_fsm_out \
	-label "Hard synchronization" $TCOMP/$INST1/hard_sync_edge_valid
Martin Jeřábek's avatar
Martin Jeřábek committed
136

137 138 139 140 141 142
add wave -group "CAN Core (1)" \
	-label "Protocol state" $TCOMP/$INST1/$CORE/pc_state \
	-label "Operational state" $TCOMP/$INST1/$CORE/op_state \
	-label "Error state" $TCOMP/$INST1/$CORE/error_state \
	-label "TX error counter" $TCOMP/$INST1/$CORE/tx_counter_out \
	-label "RX error counter" $TCOMP/$INST1/$CORE/rx_counter_out \
143 144
	-label "Bit error" $TCOMP/$INST1/$CORE/bit_error_valid \
	-label "Stuff error" $TCOMP/$INST1/$CORE/stuff_error_valid \
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
	-label "Ack error" $TCOMP/$INST1/$CORE/ack_error \
	-label "CRC error" $TCOMP/$INST1/$CORE/crc_error \
	-label "Form error" $TCOMP/$INST1/$CORE/form_error \
	-label "Transmittion finished" $TCOMP/$INST1/$CORE/tran_valid \
	-label "Reception finished" $TCOMP/$INST1/$CORE/rec_valid \
	-label "CRC 15" -hexadecimal $TCOMP/$INST1/$CORE/crc15 \
	-label "CRC 17" -hexadecimal $TCOMP/$INST1/$CORE/crc17 \
	-label "CRC 21" -hexadecimal $TCOMP/$INST1/$CORE/crc21 \
	-label "Transmitt trigger" $TCOMP/$INST1/$CORE/tran_trig \
	-label "Recieve trigger" $TCOMP/$INST1/$CORE/rec_trig \
	-label "Insert stuff bit" $TCOMP/$INST1/$CORE/data_halt \
	-label "Bit is destuffed" $TCOMP/$INST1/$CORE/destuffed \
	-label "Stuffing length" $TCOMP/$INST1/$CORE/bs_length \
	-label "DeStuffing length" $TCOMP/$INST1/$CORE/bds_length \
	-label "Stuffing enabled" $TCOMP/$INST1/$CORE/bs_enable \
	-label "DeStuffing enabled" $TCOMP/$INST1/$CORE/bds_enable \
	-label "Fixed stuff" $TCOMP/$INST1/$CORE/fixed_stuff \
	-label "Fixed de-stuff" $TCOMP/$INST1/$CORE/fixed_destuff \
	-label "Stuff count grey coded" $TCOMP/$INST1/$CORE/PC_State_comp/stuff_count_grey \
	-label "stuff_parity" $TCOMP/$INST1/$CORE/PC_State_comp/stuff_parity \
	-label "CRC check" $TCOMP/$INST1/$CORE/PC_State_comp/crc_check \
	-label "Rx parity" $TCOMP/$INST1/$CORE/PC_State_comp/rx_parity \
	-label "Rx count grey" $TCOMP/$INST1/$CORE/PC_State_comp/rx_count_grey \
	-label "Rx CRC" -hexadecimal $TCOMP/$INST1/$CORE/PC_State_comp/rec_crc_r \
Martin Jeřábek's avatar
Martin Jeřábek committed
169 170
	-label "Stuff counter" $TCOMP/$INST1/$CORE/st_ctr_resolved

171
add wave -group "Bus sampling (1)" \
172 173
	-label "Measure transceiver delay" $TCOMP/$INST1/trv_delay_calib \
	-label "Transceiver delay" $TCOMP/$INST1/bus_sync_comp/trv_delay \
174 175 176 177 178 179 180 181
	-label "Measurment running" $TCOMP/$INST1/bus_sync_comp/trv_running \
	-label "Reset secondary sampling" $TCOMP/$INST1/ssp_reset \
	-label "Bit error secondary sampling" $TCOMP/$INST1/bit_error_sec_sam \
	-label "Tripple sampling registers" $TCOMP/$INST1/bus_sync_comp/trs_reg \



add wave -noupdate -divider -height 20 "Node 2"
182
quietly set INST1 "g_inst(2)/can_inst"
183

184 185 186 187 188
add wave -label "Memory bus" "$TCOMP/mem_bus(2)"
add wave -label "CAN_TX" $TCOMP/$SIG2.can_tx
add wave -label "CAN_RX" $TCOMP/$SIG2.can_rx
add wave -label "Interrupt" $TCOMP/$SIG2.int
add wave -label "Transceiver delay" $TCOMP/$SIG2.tr_del
189 190
add wave -label "Driving bus" $TCOMP/$INST1/drv_bus
add wave -label "Status bus" $TCOMP/$INST1/stat_bus
Martin Jeřábek's avatar
Martin Jeřábek committed
191

192 193 194 195 196 197 198 199 200 201 202
add wave -group "RX Buffer (2)" \
	-label "RX_DATA" $TCOMP/$INST1/rx_read_buff \
	-label "Buffer size" -unsigned $TCOMP/$INST1/rx_buf_size \
	-label "Full" $TCOMP/$INST1/rx_full \
	-label "Empty" $TCOMP/$INST1/rx_empty \
	-label "Frames stored" -unsigned $TCOMP/$INST1/rx_message_count \
	-label "Free words" -unsigned $TCOMP/$INST1/rx_mem_free \
	-label "Read pointer" -unsigned $TCOMP/$INST1/rx_read_pointer_pos \
	-label "Write pointer" -unsigned $TCOMP/$INST1/rx_write_pointer_pos \
	-label "Data overrun" -unsigned $TCOMP/$INST1/rx_data_overrun

203 204 205
add wave -group "TXT Buffers (2)" \
	-label "FSM States" $TCOMP/$INST1/txtb_fsms

206 207 208 209 210
add wave -group "Interrupt manager (2)" \
	-label "Interrupt vector" $TCOMP/$INST1/int_vector \
	-label "Interrupt enable" $TCOMP/$INST1/int_ena \
	-label "Interrupt mask" $TCOMP/$INST1/int_mask

211 212 213 214 215 216 217 218
add wave -group "Frame to transmit (2)" \
	-label "Frame is valid" $TCOMP/$INST1/tran_frame_valid_out \
	-label "data" -hexadecimal $TCOMP/$INST1/tran_data_out \
	-label "DLC" $TCOMP/$INST1/tran_dlc_out \
	-label "RTR" $TCOMP/$INST1/tran_is_rtr \
	-label "Identifier type" $TCOMP/$INST1/tran_ident_type_out \
	-label "Frame format" $TCOMP/$INST1/tran_frame_type_out \
	-label "BRS" $TCOMP/$INST1/tran_brs_out
Martin Jeřábek's avatar
Martin Jeřábek committed
219

220 221
add wave -group "Frame to recieve (2)" \
	-label "Frame is valid" $TCOMP/$INST1/rec_message_valid \
222 223
	-label "Data word" -hexadecimal $TCOMP/$INST1/rx_store_data_word \
	-label "Store Data word" -hexadecimal $TCOMP/$INST1/rx_store_data \
224 225 226 227 228 229 230
	-label "identifier" $TCOMP/$INST1/rec_ident_in \
	-label "DLC" $TCOMP/$INST1/rec_dlc_in \
	-label "RTR" $TCOMP/$INST1/rec_is_rtr \
	-label "Identifier type" $TCOMP/$INST1/rec_ident_type_in \
	-label "Frame format" $TCOMP/$INST1/rec_frame_type_in \
	-label "BRS" $TCOMP/$INST1/rec_brs \
	-label "ESI" $TCOMP/$INST1/rec_esi
Martin Jeřábek's avatar
Martin Jeřábek committed
231

232 233 234 235 236 237 238 239 240 241 242
add wave -group "Prescaler (2)" \
	-label "Time quantum (Nominal)" $TCOMP/$INST1/clk_tq_nbt \
	-label "Time quantum (Data)" $TCOMP/$INST1/clk_tq_dbt \
	-label "Sync (Nominal)" $TCOMP/$INST1/sync_nbt \
	-label "Sync (Data)" $TCOMP/$INST1/sync_dbt \
	-label "Sample (Nominal)" $TCOMP/$INST1/sample_nbt \
	-label "Sample (Data)" $TCOMP/$INST1/sample_dbt \
	-label "Sample type" $TCOMP/$INST1/sp_control \
	-label "Synchronization type" $TCOMP/$INST1/sync_control \
	-label "Bit time state" $TCOMP/$INST1/bt_fsm_out \
	-label "Hard synchronization" $TCOMP/$INST1/hard_sync_edge_valid
Martin Jeřábek's avatar
Martin Jeřábek committed
243

244 245 246 247 248 249
add wave -group "CAN Core (2)" \
	-label "Protocol state" $TCOMP/$INST1/$CORE/pc_state \
	-label "Operational state" $TCOMP/$INST1/$CORE/op_state \
	-label "Error state" $TCOMP/$INST1/$CORE/error_state \
	-label "TX error counter" $TCOMP/$INST1/$CORE/tx_counter_out \
	-label "RX error counter" $TCOMP/$INST1/$CORE/rx_counter_out \
250 251
	-label "Bit error" $TCOMP/$INST1/$CORE/bit_error_valid \
	-label "Stuff error" $TCOMP/$INST1/$CORE/stuff_error_valid \
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
	-label "Ack error" $TCOMP/$INST1/$CORE/ack_error \
	-label "CRC error" $TCOMP/$INST1/$CORE/crc_error \
	-label "Form error" $TCOMP/$INST1/$CORE/form_error \
	-label "Transmittion finished" $TCOMP/$INST1/$CORE/tran_valid \
	-label "Reception finished" $TCOMP/$INST1/$CORE/rec_valid \
	-label "CRC 15" -hexadecimal $TCOMP/$INST1/$CORE/crc15 \
	-label "CRC 17" -hexadecimal $TCOMP/$INST1/$CORE/crc17 \
	-label "CRC 21" -hexadecimal $TCOMP/$INST1/$CORE/crc21 \
	-label "Transmitt trigger" $TCOMP/$INST1/$CORE/tran_trig \
	-label "Recieve trigger" $TCOMP/$INST1/$CORE/rec_trig \
	-label "Insert stuff bit" $TCOMP/$INST1/$CORE/data_halt \
	-label "Bit is destuffed" $TCOMP/$INST1/$CORE/destuffed \
	-label "Stuffing length" $TCOMP/$INST1/$CORE/bs_length \
	-label "DeStuffing length" $TCOMP/$INST1/$CORE/bds_length \
	-label "Stuffing enabled" $TCOMP/$INST1/$CORE/bs_enable \
	-label "DeStuffing enabled" $TCOMP/$INST1/$CORE/bds_enable \
	-label "Fixed stuff" $TCOMP/$INST1/$CORE/fixed_stuff \
	-label "Fixed de-stuff" $TCOMP/$INST1/$CORE/fixed_destuff \
Martin Jeřábek's avatar
Martin Jeřábek committed
270 271
	-label "Stuff counter" $TCOMP/$INST1/$CORE/st_ctr_resolved

272
add wave -group "Bus sampling (2)" \
273 274
	-label "Measure transceiver delay" $TCOMP/$INST1/trv_delay_calib \
	-label "Transceiver delay" $TCOMP/$INST1/bus_sync_comp/trv_delay \
275 276 277 278
	-label "Measurment running" $TCOMP/$INST1/bus_sync_comp/trv_running \
	-label "Reset secondary sampling" $TCOMP/$INST1/ssp_reset \
	-label "Bit error secondary sampling" $TCOMP/$INST1/bit_error_sec_sam \
	-label "Tripple sampling registers" $TCOMP/$INST1/bus_sync_comp/trs_reg \