ELGIP-159 Extended to 32-bit positions into the generic_sequencer
This commit is contained in:
parent
4cb12f59ed
commit
9aafd43f5e
4 changed files with 356 additions and 237 deletions
|
|
@ -148,8 +148,8 @@ add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_start_req_d
|
|||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/add_img_size_d
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/abort_fire
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_write
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_read
|
||||
add wave -noupdate -color magenta /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_write
|
||||
add wave -noupdate -color magenta /ch_ctrl_cfg_tb/iUUT/ch_ctrl_csr_read
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/frac_div_en_i
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_max_pos
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/upd_min_pos
|
||||
|
|
@ -235,10 +235,129 @@ add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/shf_enable
|
|||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/delay_line
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/local_time_d
|
||||
add wave -noupdate /ch_ctrl_cfg_tb/iUUT/iPD_queue/event_time
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clk
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/reset_n
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_csr_address
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_csr_write
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_csr_writedata
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_csr_read
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_csr_readdata
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_seq_address
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_seq_write
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_seq_writedata
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_seq_read
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/avs_seq_readdata
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/start_req
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/start_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/trigger_in
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pos_in
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/busy
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_out
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/bus_data
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/bus_valid
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/bus_ack
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/fsm
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/fsm_nxt
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_cfg_aux
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_enable
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/rst_vector_out
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/debug_mode
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ram_rd_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ram_rd_data
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/operand_1
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/operand_2
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/operand_comp
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/opcode
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/subcode
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/jump_addr_ext
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/jump_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pc_value
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pos_store_csr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pos_store
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pos_target
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/pos_comp_msbs
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/trig_mask
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/trig_sel
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/trig_int
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_out_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_curr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_next
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_final
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_diff
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/op_cnt
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/loop_cnt
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/return_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/r1
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/r1_data
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/r1_data_valid
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/decode
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_vec
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_vec
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/bus_valid_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/busy_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_start_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/inc_ram_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_trig_mask
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_trig_sel
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_pos
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_ramp
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/zero_flag
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/alu_upd
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_vec_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_vec_ii
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/fetch_op
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_up
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/op_cnt_done
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/inc_op_cnt
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/bus_pause
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_jmp_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/jump_abs
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/jump_rel
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/jump_r1
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ld_ret_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/save_ret_addr
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/loop_active
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/loop_upd
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/loop_done
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_diff_top
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/start_req_d
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/start_req_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_to_val
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_done
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/ramp_to_val_last
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_val_cpu
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_cpu
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/step_req
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/fetch_enable
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_seq_queue
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_seq_queue_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_seq_queue_exe
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_add_flag
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_add_flag_d
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_add_flag_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_inc
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_dec
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_completed
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_queue_empty
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/set_queue_empty
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_add
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_add_i
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_left
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/queue_exec
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/debug_mode_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_seq_queue_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/clr_seq_queue_exe_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_val_cpu_p
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/vector_cpu_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/r1_data_valid_p
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/r1_data_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_queue_w_p
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/seq_queue_w_r
|
||||
add wave -noupdate -expand -group {Generic Sequencer_18} /ch_ctrl_cfg_tb/iUUT/i_channel_control/trigger_csr
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {2135755000 ps} 0} {{Cursor 2} {15451360286 ps} 0}
|
||||
quietly wave cursor active 2
|
||||
configure wave -namecolwidth 293
|
||||
WaveRestoreCursors {{Cursor 1} {5570757 ps} 0} {{Cursor 2} {15451360286 ps} 0}
|
||||
quietly wave cursor active 1
|
||||
configure wave -namecolwidth 391
|
||||
configure wave -valuecolwidth 216
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 0
|
||||
|
|
@ -252,4 +371,4 @@ configure wave -griddelta 40
|
|||
configure wave -timeline 0
|
||||
configure wave -timelineunits ps
|
||||
update
|
||||
WaveRestoreZoom {17886802338 ps} {19427520930 ps}
|
||||
WaveRestoreZoom {5134368 ps} {6588614 ps}
|
||||
|
|
|
|||
|
|
@ -328,11 +328,11 @@ begin
|
|||
-- - Gating signal (ch_mask)
|
||||
|
||||
i_channel_control : entity work.generic_sequencer_18
|
||||
generic map(
|
||||
generic map( -- @suppress "Generic map uses default values. Missing optional actuals: RAMP_WIDTH, DEVICE_FAMILY"
|
||||
TRIGGER_WIDTH => 6,
|
||||
VECTOR_WIDTH => 24,
|
||||
BUS_WIDTH => 32,
|
||||
POS_WIDTH => 24,
|
||||
POS_WIDTH => 32,
|
||||
SEQ_DEPTH => 256,
|
||||
ADD_VEC_PIPE => false,
|
||||
VECT_CPU_EN => false,
|
||||
|
|
@ -357,7 +357,7 @@ begin
|
|||
start_req => ch_ctrl_start_req,
|
||||
start_addr => ch_ctrl_start_addr,
|
||||
trigger_in => ch_ctrl_trigger_in,
|
||||
pos_in => abs_position(23 downto 0),
|
||||
pos_in => abs_position,
|
||||
busy => ch_ctrl_busy,
|
||||
vector_out => ch_ctrl_vector_out,
|
||||
bus_data => seq_bus_data,
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
30000000
|
||||
1000000F
|
||||
C0000003
|
||||
C0000004
|
||||
30000000
|
||||
30000000
|
||||
20000001
|
||||
C0000008
|
||||
30006424
|
||||
30006400
|
||||
81000032
|
||||
23000001
|
||||
30000000
|
||||
C000000E
|
||||
C000000F
|
||||
30000010
|
||||
30000010
|
||||
23000001
|
||||
C0000013
|
||||
30006434
|
||||
30006410
|
||||
81000032
|
||||
23000001
|
||||
C0000013
|
||||
30000000 VEC_SET (000000)
|
||||
1000000F TRIG_MASK xF
|
||||
C0000003 JUMP to 3
|
||||
C0000004 JUMP to 4
|
||||
30000000 VEC_SET (000000)
|
||||
30000000 VEC_SET (000000)
|
||||
20000001 TRIG_WAIT bit 0 (loc_pd), 1 time
|
||||
C0000008 JUMP to 8
|
||||
30006424 VEC_SET (006424) img_size | zero_gap_mode, X, X, prevent_div_restart | add_img_size, start_img_req, ch_mask, cnt_dir
|
||||
30006400 VEC_SET (006400)
|
||||
81000032 POS_WAIT 1=offset vs current pos x32 offset
|
||||
23000001 TRIG_WAIT bit 3 (not fire_enable), 1 time
|
||||
30000000 VEC_SET (000000)
|
||||
C000000E JUMP to 14
|
||||
C000000F JUMP to 15
|
||||
30000010 VEC_SET (000010) prevent_div_restart
|
||||
30000010 VEC_SET (000010) prevent_div_restart
|
||||
23000001 TRIG_WAIT bit 3 (not fire_enable), 1 time
|
||||
C0000013 JUMP to 19
|
||||
30006434 VEC_SET (006434) img_size | zero_gap_mode, X, X, prevent_div_restart | add_img_size, start_img_req, ch_mask, cnt_dir
|
||||
30006410 VEC_SET (006410)
|
||||
81000032 POS_WAIT 1=offset vs current pos x32 offset
|
||||
23000001 TRIG_WAIT bit 3 (not fire_enable), 1 time
|
||||
C0000013 JUMP to 19
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
|
|
|
|||
|
|
@ -33,32 +33,32 @@ end entity ch_ctrl_cfg_tb;
|
|||
|
||||
architecture behav of ch_ctrl_cfg_tb is
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
|
||||
-- Logging Verbosity Level
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM;
|
||||
|
||||
constant seq_config_file : string := "./../src/test/ch_ctrl_cfg2.cfg";
|
||||
|
||||
type cfg_data_t is array (natural range <>) of std_logic_vector(31 downto 0);
|
||||
type cfg_data_t is array (natural range <>) of std_logic_vector(31 downto 0);
|
||||
|
||||
constant SEQ_SIZE : natural := 256;
|
||||
|
||||
subtype seq_cfg_data_t is cfg_data_t(0 to SEQ_SIZE-1);
|
||||
subtype seq_cfg_data_t is cfg_data_t(0 to SEQ_SIZE - 1);
|
||||
|
||||
-- Total number of wheel rotations to simulate
|
||||
constant TOTAL_ROTATIONS : natural := 100;
|
||||
constant TOTAL_ROTATIONS : natural := 200;
|
||||
-- DIV_RATIO: head-pitch/ encoder-global-resolution
|
||||
constant DIV_RATIO : real := 4.23;
|
||||
constant DIV_RATIO : real := 4.23;
|
||||
-- Nominal image size, in pixel
|
||||
constant IMG_LEN : natural := 100;
|
||||
constant IMG_LEN : natural := 100;
|
||||
-- Nominal Distance between PDs, in encoder pulses, which corresponds to the
|
||||
-- wheel circumference
|
||||
constant WHEEL_CIRCUM : real := real(IMG_LEN)*DIV_RATIO;
|
||||
constant WHEEL_CIRCUM : real := real(IMG_LEN) * DIV_RATIO;
|
||||
|
||||
-- number of Rotations before stopping the simulation
|
||||
-- constant SIM_ROTATIONS : natural := TOTAL_ROTATIONS;
|
||||
constant SIM_ROTATIONS : natural := 90;
|
||||
constant SIM_ROTATIONS : natural := 190;
|
||||
|
||||
constant APPLY_CORR_EN : boolean := true;
|
||||
constant APPLY_EMUL_CORR : boolean := false;
|
||||
|
|
@ -67,10 +67,10 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
constant PD_OFFSET : natural := 10;
|
||||
|
||||
constant HALF_RNG_CROSS : std_logic_vector(31 downto 0) := X"7FFFFFFF";
|
||||
constant FULL_RNG_CROSS : std_logic_vector(31 downto 0) := X"FFFFFFFF";
|
||||
constant FULL_RNG_CROSS : std_logic_vector(31 downto 0) := X"FFFFFFFF";
|
||||
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(HALF_RNG_CROSS)-50 -PD_OFFSET);
|
||||
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(HALF_RNG_CROSS)-421 -PD_OFFSET);
|
||||
constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(FULL_RNG_CROSS)-421 -PD_OFFSET);
|
||||
constant INIT_ABS_POS : std_logic_vector(31 downto 0) := std_logic_vector(signed(FULL_RNG_CROSS) - 421 - PD_OFFSET);
|
||||
--constant INIT_ABS_POS : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
-- Correction Loop Filter constants
|
||||
|
|
@ -78,7 +78,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
constant LOOP_FILT_TOT : real := 1.0;
|
||||
|
||||
|
||||
type wheel_error_t is array (0 to TOTAL_ROTATIONS-1) of integer;
|
||||
type wheel_error_t is array (0 to TOTAL_ROTATIONS - 1) of integer;
|
||||
|
||||
/*
|
||||
signal wheel_error : wheel_error_t := (
|
||||
|
|
@ -101,7 +101,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 1,
|
||||
1, 1, 0, 0, -1, -1, -1, -1, 0, 0, -40, 0, 0, +80, others => 0);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
signal wheel_error : wheel_error_t := (
|
||||
0, 0, 0, 0, 0, -1, -1, -1, -1, -1,
|
||||
|
|
@ -157,20 +157,20 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
signal avs_readdatavalid : std_logic;
|
||||
signal avs_readdata : std_logic_vector(31 downto 0);
|
||||
--
|
||||
signal avs_m : mm_m_rec_t;
|
||||
signal avs_s : mm_s_rec_t;
|
||||
signal avs_m : mm_m_rec_t;
|
||||
signal avs_s : mm_s_rec_t;
|
||||
--
|
||||
signal pd_in_cnt : integer;
|
||||
signal pd_out_cnt : integer;
|
||||
signal pd_in_cnt : integer;
|
||||
signal pd_out_cnt : integer;
|
||||
--
|
||||
signal end_of_stimuli : boolean;
|
||||
signal test_completed : boolean;
|
||||
signal setup : boolean;
|
||||
signal running : boolean;
|
||||
signal passed : boolean;
|
||||
signal failed : boolean;
|
||||
signal end_of_stimuli : boolean;
|
||||
signal test_completed : boolean;
|
||||
signal setup : boolean;
|
||||
signal running : boolean;
|
||||
signal passed : boolean;
|
||||
signal failed : boolean;
|
||||
|
||||
shared variable error_flag : boolean;
|
||||
shared variable error_flag : boolean;
|
||||
|
||||
signal wheel_pos : integer;
|
||||
signal pos_error : real;
|
||||
|
|
@ -182,7 +182,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
signal wh_pos_err_r : real;
|
||||
signal wheel_corr_on : std_logic;
|
||||
|
||||
signal skip_pd : std_logic;
|
||||
signal skip_pd : std_logic;
|
||||
|
||||
|
||||
|
||||
|
|
@ -191,137 +191,137 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
-----------------------------------------------------------------------------
|
||||
|
||||
procedure wait_latency(
|
||||
signal clk : in std_logic;
|
||||
cycles : in natural) is
|
||||
signal clk : in std_logic;
|
||||
cycles : in natural) is
|
||||
begin
|
||||
for i in 1 to cycles loop
|
||||
wait until clk = '1' and clk'event;
|
||||
end loop; -- i
|
||||
end loop; -- i
|
||||
end procedure wait_latency;
|
||||
|
||||
procedure read_cfg_file(
|
||||
fname : in string;
|
||||
num_data : in natural;
|
||||
read_data : out cfg_data_t) is
|
||||
|
||||
file f_id : text;
|
||||
variable status : file_open_status;
|
||||
variable InLine : line;
|
||||
variable word : std_logic_vector(31 downto 0);
|
||||
|
||||
fname : in string;
|
||||
num_data : in natural;
|
||||
read_data : out cfg_data_t) is
|
||||
|
||||
file f_id : text;
|
||||
variable status : file_open_status;
|
||||
variable InLine : line;
|
||||
variable word : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
file_open(status, f_id, fname, read_mode);
|
||||
if(status /= open_ok) then
|
||||
if (status /= open_ok) then
|
||||
log("ERROR: Failed to open file " & fname & ".", VLOW);
|
||||
error_flag := true;
|
||||
else
|
||||
|
||||
READ_LOOP: for idx in 0 to num_data-1 loop
|
||||
|
||||
|
||||
READ_LOOP : for idx in 0 to num_data - 1 loop
|
||||
|
||||
readline(f_id, InLine);
|
||||
hread(InLine, word);
|
||||
read_data(idx) := word;
|
||||
|
||||
end loop; -- READ_LOOP
|
||||
|
||||
end loop; -- READ_LOOP
|
||||
|
||||
file_close(f_id);
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
end procedure read_cfg_file;
|
||||
|
||||
-- load ch-ctrl sequencer configuration
|
||||
procedure load_seq_cfg(
|
||||
fname : in string;
|
||||
signal seq_s_rec : in mm_s_rec_t;
|
||||
signal seq_m_rec : out mm_m_rec_t) is
|
||||
fname : in string;
|
||||
signal seq_s_rec : in mm_s_rec_t;
|
||||
signal seq_m_rec : out mm_m_rec_t) is
|
||||
|
||||
variable seq_data : seq_cfg_data_t;
|
||||
variable offset : natural;
|
||||
variable addr : std_logic_vector(31 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
|
||||
read_cfg_file(fname, SEQ_SIZE, seq_data);
|
||||
|
||||
log("Configuring Ch-Ctrl RAM ...", VMEDIUM);
|
||||
offset :=512;
|
||||
for n in 0 to SEQ_SIZE-1 loop
|
||||
addr := std_logic_vector(to_unsigned(offset+n,32));
|
||||
offset := 512;
|
||||
for n in 0 to SEQ_SIZE - 1 loop
|
||||
addr := std_logic_vector(to_unsigned(offset + n, 32));
|
||||
--log("Ch-Ctrl Cfg: Addr = " & to_string(n) & ", data = 0x" & to_hstring(seq_data(n)) & ".", VMEDIUM);
|
||||
mm_32b_write(addr, seq_data(n), seq_s_rec, seq_m_rec);
|
||||
end loop; -- n
|
||||
mm_32b_write(addr, seq_data(n), seq_s_rec, seq_m_rec);
|
||||
end loop; -- n
|
||||
|
||||
end procedure load_seq_cfg;
|
||||
|
||||
procedure set_div_ratio(
|
||||
div_ratio : real;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
div_ratio : real;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
variable ratio_int : integer;
|
||||
variable ratio_slv : std_logic_vector(33 downto 0);
|
||||
variable ratio_int : integer;
|
||||
variable ratio_slv : std_logic_vector(33 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-- set the division ratio
|
||||
ratio_int := integer(div_ratio*real(2**24));
|
||||
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
|
||||
ratio_int := integer(div_ratio * real(2 ** 24));
|
||||
ratio_slv := std_logic_vector(to_unsigned(ratio_int, 34));
|
||||
-- Set the integer part of the div-ratio
|
||||
data(31 downto 10) := (others => '0');
|
||||
data( 9 downto 0) := ratio_slv(33 downto 24);
|
||||
addr := std_logic_vector(resize(unsigned(CSR_DIVIDER_RATIO_INT_ADDR), 32));
|
||||
data(9 downto 0) := ratio_slv(33 downto 24);
|
||||
addr := std_logic_vector(resize(unsigned(CSR_DIVIDER_RATIO_INT_ADDR), 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
-- Set the fractional part of the div-ratio
|
||||
data(31 downto 24) := (others => '0');
|
||||
data(23 downto 0) := ratio_slv(23 downto 0);
|
||||
addr := std_logic_vector(resize(unsigned(CSR_DIVIDER_RATIO_FRACTION_ADDR), 32));
|
||||
data(23 downto 0) := ratio_slv(23 downto 0);
|
||||
addr := std_logic_vector(resize(unsigned(CSR_DIVIDER_RATIO_FRACTION_ADDR), 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
end procedure set_div_ratio;
|
||||
|
||||
procedure enable_wheel_corr(
|
||||
enable : std_logic;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
enable : std_logic;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
begin
|
||||
|
||||
-- Read the current value of the cotrl register
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PULSE_GEN_CONTROL_W_ADDR), 32));
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PULSE_GEN_CONTROL_W_ADDR), 32));
|
||||
mm_32b_read(addr, data, mm_s_rec, mm_m_rec);
|
||||
data(11) := enable;
|
||||
-- Write back the updated value
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
if(enable = '0') then
|
||||
if (enable = '0') then
|
||||
log("Wheel Correction Disabled:", VMEDIUM);
|
||||
else
|
||||
log("Wheel Correction Enabled:", VMEDIUM);
|
||||
end if;
|
||||
|
||||
end procedure enable_wheel_corr;
|
||||
end procedure enable_wheel_corr;
|
||||
|
||||
procedure apply_pg_cfg(
|
||||
div_ratio : real;
|
||||
offset_dir0 : integer;
|
||||
offset_dir1 : integer;
|
||||
delay : integer;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
div_ratio : real;
|
||||
offset_dir0 : integer;
|
||||
offset_dir1 : integer;
|
||||
delay : integer;
|
||||
signal mm_s_rec : in mm_s_rec_t;
|
||||
signal mm_m_rec : out mm_m_rec_t) is
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
variable ratio_int : integer;
|
||||
variable ratio_slv : std_logic_vector(33 downto 0);
|
||||
variable ratio_int : integer;
|
||||
variable ratio_slv : std_logic_vector(33 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
|
|
@ -345,31 +345,31 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
|
||||
-- Set the division ratio
|
||||
set_div_ratio(div_ratio, mm_s_rec, mm_m_rec);
|
||||
|
||||
|
||||
-- Disable/Enable the fractional divider
|
||||
addr := std_logic_vector(resize(unsigned(CSR_FRACTIONAL_DIVIDER_CONTROL_ADDR), 32));
|
||||
data := (others => '0');
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
data := (0 => '1', others => '0');
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
-- Configure the rest of the pulse_generator:
|
||||
-- Configure the Channel Offset (Both DIR_0 and DIR_1):
|
||||
-- DIR_0
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PD_OFFSET_DIR_0_ADDR),32));
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PD_OFFSET_DIR_0_ADDR), 32));
|
||||
data := std_logic_vector(to_unsigned(offset_dir0, 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
-- DIR_1
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PD_OFFSET_DIR_1_ADDR), 32));
|
||||
data := std_logic_vector(to_unsigned(offset_dir1, 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
-- Configure the Channel Delay:
|
||||
addr := std_logic_vector(resize(unsigned(CSR_CHANNEL_DELAY_ADDR), 32));
|
||||
data := std_logic_vector(to_unsigned(delay, 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
|
||||
-- enable the ch-ctrl sequencer
|
||||
addr := std_logic_vector(to_unsigned(32+3, 32));
|
||||
addr := std_logic_vector(to_unsigned(32 + 3, 32));
|
||||
data := (0 => '1', others => '0');
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
-- issue a start_req to the ch-ctrl sequencer
|
||||
|
|
@ -384,7 +384,7 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
|
||||
-- Compute the constant for W&H Correction
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PIXEL_PITCH_POS_ERR_2_CORR_ADDR), 32));
|
||||
data := std_logic_vector(to_unsigned(integer(round((1.0/real(IMG_LEN))*(2.0**32))), 32));
|
||||
data := std_logic_vector(to_unsigned(integer(round((1.0 / real(IMG_LEN)) * (2.0 ** 32))), 32));
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
-- set the threshold for skipping correctiion to 256
|
||||
|
|
@ -395,32 +395,32 @@ architecture behav of ch_ctrl_cfg_tb is
|
|||
|
||||
-- enable the pulse-generator + Enable W&H Correction
|
||||
addr := std_logic_vector(resize(unsigned(CSR_PULSE_GEN_CONTROL_W_ADDR), 32));
|
||||
data := (0 => '1', 11 => '1', 16 => '1', others => '0');
|
||||
data := (0 => '1', 11 => '1', 16 => '1', others => '0');
|
||||
mm_32b_write(addr, data, mm_s_rec, mm_m_rec);
|
||||
|
||||
|
||||
log("Wheel Correction Enabled:", VMEDIUM);
|
||||
|
||||
log_separator_line(VMEDIUM);
|
||||
|
||||
|
||||
end procedure apply_pg_cfg;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- End declarative part
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
begin -- architecture behav
|
||||
begin -- architecture behav
|
||||
|
||||
clk <= not clk after 0.5*CLK_PERIOD;
|
||||
clk <= not clk after 0.5 * CLK_PERIOD;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- UUT
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
iUUT : entity work.pulse_generator_5
|
||||
generic map (
|
||||
generic map(
|
||||
PULSE_DELAY_EQUAL_EN => true,
|
||||
PIXEL_PITCH_CORR_EN => true)
|
||||
port map (
|
||||
port map(
|
||||
clk => clk,
|
||||
reset_n => reset_n,
|
||||
init => init,
|
||||
|
|
@ -450,12 +450,12 @@ begin -- architecture behav
|
|||
alias div_ratio_corr is <<signal iUUT.div_ratio_corr : std_logic_vector(33 downto 0)>>;
|
||||
|
||||
|
||||
variable pos_error : real;
|
||||
variable pos_error : real;
|
||||
variable div_ratio_corr_r : real;
|
||||
begin
|
||||
|
||||
if(SKIP_PD_EN = false) then
|
||||
wh_pos_err_r <= real(to_integer(signed(wh_pos_err)))/256.0;
|
||||
if (SKIP_PD_EN = false) then
|
||||
wh_pos_err_r <= real(to_integer(signed(wh_pos_err))) / 256.0;
|
||||
wait until clk = '1' and clk'event;
|
||||
else
|
||||
|
||||
|
|
@ -470,19 +470,19 @@ begin -- architecture behav
|
|||
|
||||
wait until rising_edge(wh_corr_meas_ready(2));
|
||||
wait until clk = '0' and clk'event;
|
||||
pos_error := real(to_integer(signed(wh_pos_err)))/256.0;
|
||||
wh_pos_err_r <= pos_error;
|
||||
pos_error := real(to_integer(signed(wh_pos_err))) / 256.0;
|
||||
wh_pos_err_r <= pos_error;
|
||||
log("Rotation #" & to_string(rotation_idx) & ": pos_error = " & to_string(pos_error) & ".", VMEDIUM);
|
||||
wait_latency(clk, 10);
|
||||
div_ratio_corr_r := real(to_integer(signed(div_ratio_corr)))/(2.0**24);
|
||||
div_ratio_corr_r := real(to_integer(signed(div_ratio_corr))) / (2.0 ** 24);
|
||||
div_ratio_corr_rr <= div_ratio_corr_r;
|
||||
|
||||
|
||||
log("Division Ratio Correction =" & to_string(div_ratio_corr_r) & ".", VMEDIUM);
|
||||
|
||||
end loop;
|
||||
|
||||
wait until running = false;
|
||||
if(abs(pos_error) > DIV_RATIO) then
|
||||
if (abs (pos_error) > DIV_RATIO) then
|
||||
error_flag := true;
|
||||
log("ERROR: simulation ended with a misalignment error bigger than 1 pixel.", VLOW);
|
||||
end if;
|
||||
|
|
@ -497,12 +497,12 @@ begin -- architecture behav
|
|||
clk_clk <= clk;
|
||||
reset_reset_n <= reset_n;
|
||||
|
||||
avs_s.mm_readdata <= avs_readdata;
|
||||
|
||||
avs_s.mm_readdata <= avs_readdata;
|
||||
|
||||
avs_s.mm_readdatavalid <= avs_readdatavalid;
|
||||
|
||||
avs_s.mm_waitrequest <= '0';
|
||||
avs_s.use_readvalid <= true;
|
||||
|
||||
avs_s.mm_waitrequest <= '0';
|
||||
avs_s.use_readvalid <= true;
|
||||
|
||||
avs_address <= avs_m.mm_address(avs_address'range);
|
||||
avs_write <= avs_m.mm_write;
|
||||
|
|
@ -511,15 +511,15 @@ begin -- architecture behav
|
|||
|
||||
pCNT_CH_PD : process(reset_n, clk)
|
||||
begin
|
||||
if(reset_n = '0') then
|
||||
if (reset_n = '0') then
|
||||
pd_out_cnt <= 0;
|
||||
elsif(clk = '1' and clk'event) then
|
||||
if(ch_pd = '1') then
|
||||
elsif (clk = '1' and clk'event) then
|
||||
if (ch_pd = '1') then
|
||||
pd_out_cnt <= pd_out_cnt + 1;
|
||||
end if;
|
||||
end if;
|
||||
end process pCNT_CH_PD;
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Testbench Logic
|
||||
-----------------------------------------------------------------------------
|
||||
|
|
@ -542,22 +542,22 @@ begin -- architecture behav
|
|||
wait for 1 us;
|
||||
|
||||
-- send the initial PD event
|
||||
|
||||
|
||||
wait until clk = '1' and clk'event;
|
||||
log("Issueing Initial PD ...", VLOW);
|
||||
pd_in <= '1';
|
||||
pd_in <= '1';
|
||||
pd_in_cnt <= pd_in_cnt + 1;
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
pd_in <= '0';
|
||||
|
||||
while pd_in_cnt < TOTAL_ROTATIONS loop
|
||||
|
||||
wait_latency(clk, 50);
|
||||
abs_position <= std_logic_vector(signed(abs_position)+ 1);
|
||||
abs_position <= std_logic_vector(signed(abs_position) + 1);
|
||||
|
||||
if((wheel_pos + 1) = integer(WHEEL_CIRCUM+real(wheel_error(pd_in_cnt))+0.5)) then
|
||||
if ((wheel_pos + 1) = integer(WHEEL_CIRCUM + real(wheel_error(pd_in_cnt)) + 0.5)) then
|
||||
-- it's time to issue a new PD
|
||||
if(skip_pd = '0') then
|
||||
if (skip_pd = '0') then
|
||||
pd_in <= '1';
|
||||
else
|
||||
log("Skipped PD (PD count = " & to_string(pd_in_cnt) & ").", VLOW);
|
||||
|
|
@ -565,26 +565,26 @@ begin -- architecture behav
|
|||
pd_in_cnt <= pd_in_cnt + 1;
|
||||
wheel_pos <= 0;
|
||||
wait until clk = '1' and clk'event;
|
||||
pd_in <= '0';
|
||||
pd_in <= '0';
|
||||
else
|
||||
wheel_pos <= wheel_pos + 1;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
end loop;
|
||||
|
||||
-- completed
|
||||
end_of_stimuli <= true;
|
||||
|
||||
wait;
|
||||
|
||||
wait;
|
||||
|
||||
end process pSTIMULI;
|
||||
|
||||
pSKIP_PD : process
|
||||
begin
|
||||
if(pd_in_cnt = 47 or pd_in_cnt = 6 or pd_in_cnt = 49 or
|
||||
if (pd_in_cnt = 47 or pd_in_cnt = 6 or pd_in_cnt = 49 or
|
||||
pd_in_cnt = 43 or pd_in_cnt = 48 or pd_in_cnt = 55 or
|
||||
pd_in_cnt = 62 or pd_in_cnt = 71 or pd_in_cnt = 72) then
|
||||
if(SKIP_PD_EN = true) then
|
||||
if (SKIP_PD_EN = true) then
|
||||
skip_pd <= '1';
|
||||
end if;
|
||||
else
|
||||
|
|
@ -603,10 +603,10 @@ begin -- architecture behav
|
|||
variable start_pos : integer;
|
||||
|
||||
alias div_ratio_corr is <<signal iUUT.div_ratio_corr : std_logic_vector(33 downto 0)>>;
|
||||
alias div_ratio_i is <<signal iUUT.div_ratio_i : std_logic_vector(33 downto 0)>>;
|
||||
alias div_ratio_i is <<signal iUUT.div_ratio_i : std_logic_vector(33 downto 0)>>;
|
||||
|
||||
|
||||
procedure apply_correction(pos_error: in real) is
|
||||
procedure apply_correction(pos_error : in real) is
|
||||
variable div_ratio_new : real;
|
||||
variable div_ratio_man : real;
|
||||
variable div_ratio_vec : std_logic_vector(33 downto 0);
|
||||
|
|
@ -614,65 +614,65 @@ begin -- architecture behav
|
|||
variable delta_error : real;
|
||||
begin
|
||||
-- compute the total and the delta loop error
|
||||
tot_error := pos_error;
|
||||
delta_error := pos_error-pos_error_old;
|
||||
tot_error := pos_error;
|
||||
delta_error := pos_error - pos_error_old;
|
||||
-- Compute the correction through a 2nd order loop filter
|
||||
div_ratio_new := div_ratio_r + (delta_error*LOOP_FILT_DELTA+tot_error*LOOP_FILT_TOT)*(1.0/real(IMG_LEN));
|
||||
div_ratio_new := div_ratio_r + (delta_error * LOOP_FILT_DELTA + tot_error * LOOP_FILT_TOT) * (1.0 / real(IMG_LEN));
|
||||
div_ratio_r <= div_ratio_new;
|
||||
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
|
||||
|
||||
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)),10));
|
||||
div_ratio_man := (div_ratio_new - floor(div_ratio_new))*(2.0**24);
|
||||
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)),24));
|
||||
|
||||
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)), 10));
|
||||
div_ratio_man := (div_ratio_new - floor(div_ratio_new)) * (2.0 ** 24);
|
||||
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)), 24));
|
||||
-- force the correction into the UUT:
|
||||
if(APPLY_EMUL_CORR = true) then
|
||||
if (APPLY_EMUL_CORR = true) then
|
||||
div_ratio_i <= force div_ratio_vec;
|
||||
end if;
|
||||
-- save the correction value
|
||||
log("Division Ratio Correction =" & to_string(div_ratio_new-DIV_RATIO) & ".", VMEDIUM);
|
||||
|
||||
log("Division Ratio Correction =" & to_string(div_ratio_new - DIV_RATIO) & ".", VMEDIUM);
|
||||
|
||||
end procedure apply_correction;
|
||||
|
||||
-- The correction is computed emulating fixed-point numbers
|
||||
-- (pos_err-to-correction is represented with a 32 bits mantissa)
|
||||
procedure apply_correction_int(pos_error: in real) is
|
||||
variable div_ratio_new : real;
|
||||
variable div_ratio_man : real;
|
||||
variable div_ratio_vec : std_logic_vector(33 downto 0);
|
||||
variable pos_err_to_corr : integer := integer(round((1.0/real(IMG_LEN))*(2.0**32)));
|
||||
variable tot_error : real;
|
||||
variable delta_error : real;
|
||||
|
||||
procedure apply_correction_int(pos_error : in real) is
|
||||
variable div_ratio_new : real;
|
||||
variable div_ratio_man : real;
|
||||
variable div_ratio_vec : std_logic_vector(33 downto 0);
|
||||
variable pos_err_to_corr : integer := integer(round((1.0 / real(IMG_LEN)) * (2.0 ** 32)));
|
||||
variable tot_error : real;
|
||||
variable delta_error : real;
|
||||
|
||||
begin
|
||||
-- compute the total and the delta loop error
|
||||
tot_error := pos_error;
|
||||
delta_error := pos_error-pos_error_old;
|
||||
if(APPLY_EMUL_CORR = true) then
|
||||
delta_error := pos_error - pos_error_old;
|
||||
if (APPLY_EMUL_CORR = true) then
|
||||
-- Compute the correction through a 2nd order loop filter
|
||||
div_ratio_new := div_ratio_r + (delta_error*LOOP_FILT_DELTA+tot_error*LOOP_FILT_TOT)*real(pos_err_to_corr)/(2.0**32);
|
||||
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
|
||||
div_ratio_r <= div_ratio_new;
|
||||
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)),10));
|
||||
div_ratio_man := (div_ratio_new - floor(div_ratio_new))*(2.0**24);
|
||||
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)),24));
|
||||
div_ratio_new := div_ratio_r + (delta_error * LOOP_FILT_DELTA + tot_error * LOOP_FILT_TOT) * real(pos_err_to_corr) / (2.0 ** 32);
|
||||
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
|
||||
div_ratio_r <= div_ratio_new;
|
||||
div_ratio_vec(33 downto 24) := std_logic_vector(to_unsigned(integer(floor(div_ratio_new)), 10));
|
||||
div_ratio_man := (div_ratio_new - floor(div_ratio_new)) * (2.0 ** 24);
|
||||
div_ratio_vec(23 downto 0) := std_logic_vector(to_unsigned(integer(floor(div_ratio_man)), 24));
|
||||
else
|
||||
div_ratio_new := real(to_integer(unsigned(div_ratio_i(33 downto 24)))) + real(to_integer(unsigned(div_ratio_i(23 downto 0))))/(2.0**24);
|
||||
div_ratio_new := real(to_integer(unsigned(div_ratio_i(33 downto 24)))) + real(to_integer(unsigned(div_ratio_i(23 downto 0)))) / (2.0 ** 24);
|
||||
div_ratio_corr_r <= div_ratio_new - DIV_RATIO;
|
||||
div_ratio_r <= div_ratio_new;
|
||||
end if;
|
||||
div_ratio_r <= div_ratio_new;
|
||||
end if;
|
||||
|
||||
--log("tot_error = " & to_string(tot_error) & ", delta_error = " & to_string(delta_error), VMEDIUM);
|
||||
--log("tot_error-norm = " & to_string(256.0*tot_error) & ", delta_error-norm = " & to_string(256.0*delta_error), VMEDIUM);
|
||||
|
||||
|
||||
-- force the correction into the UUT:
|
||||
if(APPLY_EMUL_CORR = true) then
|
||||
if (APPLY_EMUL_CORR = true) then
|
||||
div_ratio_i <= force div_ratio_vec;
|
||||
end if;
|
||||
-- save the correction value
|
||||
log("Division Ratio Correction =" & to_string(div_ratio_new-DIV_RATIO) & ".", VMEDIUM);
|
||||
|
||||
log("Division Ratio Correction =" & to_string(div_ratio_new - DIV_RATIO) & ".", VMEDIUM);
|
||||
|
||||
end procedure apply_correction_int;
|
||||
|
||||
|
||||
begin
|
||||
|
||||
pos_error <= 0.0;
|
||||
|
|
@ -694,41 +694,41 @@ begin -- architecture behav
|
|||
if SKIP_PD_EN = false then
|
||||
|
||||
wait until rising_edge(ch_pd) or falling_edge(ch_mask);
|
||||
if(rising_edge(ch_pd) and falling_edge(ch_mask)) then
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= -DIV_RATIO;
|
||||
if (rising_edge(ch_pd) and falling_edge(ch_mask)) then
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= -DIV_RATIO;
|
||||
pos_error_avail := true;
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
elsif(rising_edge(ch_pd)) then
|
||||
if(measure_started = false) then
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
elsif (rising_edge(ch_pd)) then
|
||||
if (measure_started = false) then
|
||||
start_pos := to_integer(signed(abs_position));
|
||||
measure_started := true;
|
||||
else
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= real(to_integer(signed(abs_position)) - start_pos) - DIV_RATIO;
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= real(to_integer(signed(abs_position)) - start_pos) - DIV_RATIO;
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
measure_started := false;
|
||||
pos_error_avail := true;
|
||||
end if;
|
||||
elsif(falling_edge(ch_mask)) then
|
||||
if(measure_started = false) then
|
||||
elsif (falling_edge(ch_mask)) then
|
||||
if (measure_started = false) then
|
||||
start_pos := to_integer(signed(abs_position));
|
||||
measure_started := true;
|
||||
else
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= -(real(to_integer(signed(abs_position)) - start_pos)) - DIV_RATIO;
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
pos_error_old <= pos_error;
|
||||
pos_error <= -(real(to_integer(signed(abs_position)) - start_pos)) - DIV_RATIO;
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
measure_started := false;
|
||||
pos_error_avail := true;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if(pos_error_avail = true) then
|
||||
|
||||
if (pos_error_avail = true) then
|
||||
-- Do not remove this wait statement: it makes sures previous signal
|
||||
-- assignment are executed before computing the corrections
|
||||
wait until clk = '0' and clk'event;
|
||||
log("Rotation #" & to_string(rotation_idx) & ": pos_error = " & to_string(pos_error) & ".", VMEDIUM);
|
||||
if(APPLY_CORR_EN = true) then
|
||||
if (APPLY_CORR_EN = true) then
|
||||
--apply_correction(pos_error);
|
||||
apply_correction_int(pos_error);
|
||||
end if;
|
||||
|
|
@ -741,11 +741,11 @@ begin -- architecture behav
|
|||
-- testbench
|
||||
wait until rising_edge(ch_pd);
|
||||
rotation_idx <= rotation_idx + 1;
|
||||
wait_latency(clk, 20);
|
||||
wait_latency(clk, 20);
|
||||
|
||||
end if;
|
||||
|
||||
end loop;
|
||||
|
||||
end loop;
|
||||
|
||||
end process pMEAS_CORR;
|
||||
|
||||
|
|
@ -755,9 +755,9 @@ begin -- architecture behav
|
|||
|
||||
pTB_CTRL : process
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
variable addr : std_logic_vector(31 downto 0) := (others => '0');
|
||||
variable data : std_logic_vector(31 downto 0) := (others => '0');
|
||||
|
||||
begin
|
||||
|
||||
-- Set the verbosity level for logging
|
||||
|
|
@ -769,12 +769,12 @@ begin -- architecture behav
|
|||
|
||||
log_header("Ch-Ctrl Config verification:", VLOW);
|
||||
|
||||
setup <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
error_flag := false;
|
||||
setup <= false;
|
||||
running <= false;
|
||||
passed <= false;
|
||||
error_flag := false;
|
||||
|
||||
init <= '0';
|
||||
init <= '0';
|
||||
wheel_corr_on <= '0';
|
||||
|
||||
-- Reset
|
||||
|
|
@ -790,13 +790,13 @@ begin -- architecture behav
|
|||
wait for 200 ns;
|
||||
-- Configure Ch-Ctrl RAM
|
||||
load_seq_cfg(seq_config_file, avs_s, avs_m);
|
||||
|
||||
|
||||
apply_pg_cfg(
|
||||
div_ratio => DIV_RATIO,
|
||||
offset_dir0 => PD_OFFSET,
|
||||
offset_dir1 => 0,
|
||||
delay => 0,
|
||||
mm_s_rec => avs_s, mm_m_rec => avs_m);
|
||||
div_ratio => DIV_RATIO,
|
||||
offset_dir0 => PD_OFFSET,
|
||||
offset_dir1 => 0,
|
||||
delay => 0,
|
||||
mm_s_rec => avs_s, mm_m_rec => avs_m);
|
||||
|
||||
wheel_corr_on <= '1';
|
||||
|
||||
|
|
@ -807,7 +807,7 @@ begin -- architecture behav
|
|||
|
||||
log("Forward Movement:", VLOW);
|
||||
log_separator_line(VLOW);
|
||||
|
||||
|
||||
wait for 200 ns;
|
||||
wait until clk = '1' and clk'event;
|
||||
init <= '1';
|
||||
|
|
@ -821,7 +821,7 @@ begin -- architecture behav
|
|||
wait until clk = '1' and clk'event;
|
||||
|
||||
-- Disable Wheel Correction after a while
|
||||
if(SIM_ROTATIONS >= 50) then
|
||||
if (SIM_ROTATIONS >= 50) then
|
||||
-- disable wheel corrections
|
||||
wait until rotation_idx = 30;
|
||||
wait for 200 ns;
|
||||
|
|
@ -840,7 +840,7 @@ begin -- architecture behav
|
|||
running <= false;
|
||||
passed <= true after 100 ns;
|
||||
wait;
|
||||
|
||||
|
||||
end process pTB_CTRL;
|
||||
|
||||
failed <= error_flag after 100 ns;
|
||||
|
|
@ -850,9 +850,9 @@ begin -- architecture behav
|
|||
wait until failed = true or passed = true;
|
||||
wait for 1 us;
|
||||
log_separator_line(VLOW);
|
||||
if(failed = true) then
|
||||
if (failed = true) then
|
||||
log("FAILURE: test completed with errors.", VLOW);
|
||||
elsif(passed = true) then
|
||||
elsif (passed = true) then
|
||||
log("SUCCESS: test successfully completed.", VLOW);
|
||||
end if;
|
||||
log_separator_line(VLOW);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue