feature_env_setup.tcl 12.6 KB
Newer Older
1
################################################################################
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
2
## 
3
## CAN with Flexible Data-Rate IP Core 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
4 5 6 7 8 9 10 11
## 
## Copyright (C) 2017 Ondrej Ille <ondrej.ille@gmail.com>
## 
## 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/)
## 
12
## Permission is hereby granted, free of charge, to any person obtaining a copy 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
13 14 15 16 17 18
## 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 
## Component is furnished to do so, subject to the following conditions:
## 
19
## The above copyright notice and this permission notice shall be included in 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
20 21 22
## all copies or substantial portions of the Component.
## 
## THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
23 24 25 26
## 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 
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
27 28 29
## FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS 
## IN THE COMPONENT.
## 
30 31 32
## 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 
## protocol license from Bosch.
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
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
## Description:
## 			Feature environment waveform setup script
################################################################################
global TCOMP
global INST1
global CORE

start_CAN_simulation "feature_env_test_wrapper"
quietly set INST1 "can_inst_1"
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"
add wave -label "Node 1 clock" $TCOMP/clk_sys_1
add wave -label "Node 2 clock" $TCOMP/clk_sys_2
add wave -label "Node 1 reset" $TCOMP/res_n_1
add wave -label "Node 2 reset" $TCOMP/res_n_2
add wave -label "Timestamp 1" $TCOMP/timestamp_1
add wave -label "Timestamp 2" $TCOMP/timestamp_2
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


add wave -noupdate -divider -height 20 "Node 1"	

add wave -label "Memory bus" $TCOMP/mem_bus_1
add wave -label "CAN_TX" $TCOMP/can_tx_1
add wave -label "CAN_RX" $TCOMP/can_rx_1
add wave -label "Interrupt" $TCOMP/int_1
add wave -label "Transciever delay" $TCOMP/tr_del_1
add wave -label "Driving bus" $TCOMP/$INST1/drv_bus
add wave -label "Status bus" $TCOMP/$INST1/stat_bus
								
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

92 93 94 95 96
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

97 98 99 100 101 102 103 104 105 106 107
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
	
add wave -group "Frame to recieve (1)" \
	-label "Frame is valid" $TCOMP/$INST1/rec_message_valid \
108 109
	-label "Data word" -hexadecimal $TCOMP/$INST1/rx_store_data_word \
	-label "Store Data word" -hexadecimal $TCOMP/$INST1/rx_store_data \
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
	-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
	
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
	
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 \
136 137
	-label "Bit error" $TCOMP/$INST1/$CORE/bit_error_valid \
	-label "Stuff error" $TCOMP/$INST1/$CORE/stuff_error_valid \
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
	-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 \
	-label "Stuff counter" $TCOMP/$INST1/$CORE/st_ctr_resolved		
			
add wave -group "Bus sampling (1)" \
	-label "Measure transciever delay" $TCOMP/$INST1/trv_delay_calib \
	-label "Transciever delay" $TCOMP/$INST1/bus_sync_comp/trv_delay \
	-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"
quietly set INST1 "can_inst_2"

177 178 179 180 181
add wave -label "Memory bus" $TCOMP/mem_bus_2
add wave -label "CAN_TX" $TCOMP/can_tx_2
add wave -label "CAN_RX" $TCOMP/can_rx_2
add wave -label "Interrupt" $TCOMP/int_2
add wave -label "Transciever delay" $TCOMP/tr_del_2
182 183 184 185 186 187 188 189 190 191 192 193 194 195
add wave -label "Driving bus" $TCOMP/$INST1/drv_bus
add wave -label "Status bus" $TCOMP/$INST1/stat_bus
								
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

196 197 198 199 200
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

201 202 203 204 205 206 207 208 209 210 211
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
	
add wave -group "Frame to recieve (2)" \
	-label "Frame is valid" $TCOMP/$INST1/rec_message_valid \
212 213
	-label "Data word" -hexadecimal $TCOMP/$INST1/rx_store_data_word \
	-label "Store Data word" -hexadecimal $TCOMP/$INST1/rx_store_data \
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
	-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
	
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
	
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 \
240 241
	-label "Bit error" $TCOMP/$INST1/$CORE/bit_error_valid \
	-label "Stuff error" $TCOMP/$INST1/$CORE/stuff_error_valid \
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
	-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 counter" $TCOMP/$INST1/$CORE/st_ctr_resolved		
			
add wave -group "Bus sampling (2)" \
	-label "Measure transciever delay" $TCOMP/$INST1/trv_delay_calib \
	-label "Transciever delay" $TCOMP/$INST1/bus_sync_comp/trv_delay \
	-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 \