URL
https://opencores.org/ocsvn/ha1588/ha1588/trunk
Subversion Repositories ha1588
Compare Revisions
- This comparison shows the changes necessary to convert path
/ha1588/trunk/sim
- from Rev 21 to Rev 22
- ↔ Reverse comparison
Rev 21 → Rev 22
/top/ptp_drv_bfm/ptp_drv_bfm.c
8,20 → 8,94
int cpu_data_i; |
int cpu_data_o; |
|
int t; |
for (t=0; t<=4000; t=t+4) |
// LOAD RTC PERIOD AND ACC_MODULO |
cpu_addr_i = 0x00000020; |
cpu_data_i = 0x8; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000024; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000028; |
cpu_data_i = 0x3B9ACA00; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x0000002C; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x4; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
// RESET RTC |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x10; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
// LOAD RTC SEC AND NS |
cpu_addr_i = 0x00000010; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000014; |
cpu_data_i = 0x1; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000018; |
cpu_data_i = 0x3B9AC9F6; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x0000001C; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x8; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
// LOAD RTC ADJ |
cpu_addr_i = 0x00000030; |
cpu_data_i = 0x100; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000038; |
cpu_data_i = 0x1; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x0000003C; |
cpu_data_i = 0x20; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x2; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
// READ RTC SEC AND NS |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x1; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0x00000000; |
cpu_data_i = 0x0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
cpu_addr_i = 0X00000040; |
cpu_rd(cpu_addr_i, &cpu_data_o); |
cpu_addr_i = 0X00000044; |
cpu_rd(cpu_addr_i, &cpu_data_o); |
cpu_addr_i = 0X00000048; |
cpu_rd(cpu_addr_i, &cpu_data_o); |
cpu_addr_i = 0X0000004C; |
cpu_rd(cpu_addr_i, &cpu_data_o); |
|
// READ BACK ALL REGISTERS |
for (;;) |
{ |
|
cpu_addr_i = 0x00000000+t; |
cpu_data_i = t+0; |
cpu_wr(cpu_addr_i, cpu_data_i); |
|
//cpu_hd(50); |
|
cpu_addr_i = 0x00000000+t; |
int t; |
for (t=0; t<=0x5c; t=t+4) |
{ |
cpu_addr_i = t; |
cpu_rd(cpu_addr_i, &cpu_data_o); |
|
//cpu_hd(100); |
cpu_hd(10); |
} |
} |
|
return(0); /* Return success (required by tasks) */ |
/top/wave.do
1,42 → 1,50
onerror {resume} |
quietly WaveActivateNextPane {} 0 |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/up_clk |
add wave -noupdate -format Logic /ha1588_tb/up_wr |
add wave -noupdate -format Logic /ha1588_tb/up_rd |
add wave -noupdate -format Literal /ha1588_tb/up_addr |
add wave -noupdate -format Literal /ha1588_tb/up_data_wr |
add wave -noupdate -format Literal /ha1588_tb/up_data_rd |
add wave -noupdate -format Logic /ha1588_tb/rtc_clk |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/addr_in |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/wr_in |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/rd_in |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/data_in |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/cs_00 |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/reg_00 |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/data_out_reg |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/time_reg_ns |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rtc/time_acc_48s_inc |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/time_reg_sec |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -divider {New Divider} |
TreeUpdate [SetDefaultTree] |
WaveRestoreCursors {{Cursor 1} {135271 ps} 0} |
configure wave -namecolwidth 222 |
configure wave -valuecolwidth 100 |
configure wave -justifyvalue left |
configure wave -signalnamewidth 0 |
configure wave -snapdistance 10 |
configure wave -datasetprefix 0 |
configure wave -rowmargin 4 |
configure wave -childrowmargin 2 |
configure wave -gridoffset 0 |
configure wave -gridperiod 1 |
configure wave -griddelta 40 |
configure wave -timeline 0 |
configure wave -timelineunits ns |
update |
WaveRestoreZoom {0 ps} {1136433 ps} |
onerror {resume} |
quietly WaveActivateNextPane {} 0 |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/up_clk |
add wave -noupdate -format Logic /ha1588_tb/up_wr |
add wave -noupdate -format Logic /ha1588_tb/up_rd |
add wave -noupdate -format Literal /ha1588_tb/up_addr |
add wave -noupdate -format Literal /ha1588_tb/up_data_wr |
add wave -noupdate -format Literal /ha1588_tb/up_data_rd |
add wave -noupdate -format Logic /ha1588_tb/rtc_clk |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/addr_in |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/wr_in |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/rd_in |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/data_in |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/cs_00 |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/reg_00 |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rgs/data_out_reg |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/period_ld_out |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/rtc_rst_out |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/time_ld_out |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/adj_ld_out |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rgs/time_reg_in_latch |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/time_reg_ns |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rtc/time_acc_48s_inc |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/time_reg_sec |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -format Logic /ha1588_tb/PTP_HA_DUT/u_rtc/adj_ld |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/adj_cnt |
add wave -noupdate -format Literal /ha1588_tb/PTP_HA_DUT/u_rtc/time_adj |
add wave -noupdate -divider {New Divider} |
TreeUpdate [SetDefaultTree] |
WaveRestoreCursors {{Cursor 1} {1452000 ps} 0} |
configure wave -namecolwidth 291 |
configure wave -valuecolwidth 100 |
configure wave -justifyvalue left |
configure wave -signalnamewidth 0 |
configure wave -snapdistance 10 |
configure wave -datasetprefix 0 |
configure wave -rowmargin 4 |
configure wave -childrowmargin 2 |
configure wave -gridoffset 0 |
configure wave -gridperiod 1 |
configure wave -griddelta 40 |
configure wave -timeline 0 |
configure wave -timelineunits ns |
update |
WaveRestoreZoom {0 ps} {10500 ns} |
/top/sim.do
0,0 → 1,44
quit -sim |
vlib work |
vdel -lib work -all |
vlib work |
|
# compile vendor independent files |
vlog -work work ../../rtl/top/ha1588.v +initreg+0 |
vlog -work work ../../rtl/reg/reg.v +initreg+0 |
vlog -work work ../../rtl/rtc/rtc.v +initreg+0 |
vlog -work work ../../rtl/tsu/tsu.v +initreg+0 |
vlog -work work ../../rtl/tsu/ptp_queue.v +initreg+0 |
vlog -work work ../../rtl/tsu/ptp_parser.v +initreg+0 |
|
# compile vendor dependent files |
vlog -work work altera_mf.v |
|
# compile testbench files |
vlog -work work -sv ha1588_tb.v |
|
# compile driver bfm files |
vlog -work work -sv ptp_drv_bfm/ptp_drv_bfm.v |
|
# compile driver bfm files |
# Sytemverilog DPI steps to combine sv and c |
# step 1: generate dpiheader.h |
vlog -work work -sv -dpiheader dpiheader.h ptp_drv_bfm/ptp_drv_bfm.v |
# step 2: generate ptp_drv_bfm.obj |
vsim -dpiexportobj ptp_drv_bfm_sv ptp_drv_bfm_sv |
# step 3: generate ptp_drv_bfm_c.obj |
gcc -c -I $::env(MODEL_TECH)/../include ptp_drv_bfm/ptp_drv_bfm.c |
# step 4: generate ptp_drv_bfm_c.dll |
gcc -shared -Bsymbolic -o ptp_drv_bfm_c.dll ptp_drv_bfm.o \ |
ptp_drv_bfm_sv.obj -L $::env(MODEL_TECH) -lmtipli |
|
vsim -novopt \ |
-sv_lib ptp_drv_bfm_c \ |
-t ps \ |
ha1588_tb |
|
log -r */* |
radix -hexadecimal |
do wave.do |
|
run 10000ns |
/top/sim.bat
0,0 → 1,7
title %CD% |
|
SET LM_LICENSE_FILE=C:\lmlicense\licensefile.dat |
SET MODEL_TECH=C:\modeltech_6.5b\win32 |
SET PATH=C:\Modeltech_6.5b\win32;C:\modeltech_6.5b\gcc-4.2.1-mingw32\bin |
|
vsim -do sim.do |