Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 2cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 2cha
Commits
9e19b2b1
Commit
9e19b2b1
authored
Jul 04, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added basic test for pulse generation
parent
e728dc75
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
143 additions
and
4 deletions
+143
-4
FfpgCore.vhd
hdl/ffpg/rtl/FfpgCore.vhd
+3
-0
Config.svh
hdl/ffpg/sim/testbench/Config.svh
+3
-0
Testbench.sv
hdl/ffpg/sim/testbench/Testbench.sv
+3
-2
TestbenchPackage.sv
hdl/ffpg/sim/testbench/TestbenchPackage.sv
+132
-0
sim
hdl/ffpg/sim/testbench/sim
+2
-2
No files found.
hdl/ffpg/rtl/FfpgCore.vhd
View file @
9e19b2b1
...
...
@@ -68,6 +68,9 @@ begin
Clk
<=
Wb_i
.
Clk
;
Reset
<=
Wb_i
.
Rst
;
-- TODO - simulation workaround until real dual-clock will be implemented
SerialStreamClock
<=
Clk
;
----------------------------------
-- Wishbone slave
...
...
hdl/ffpg/sim/testbench/Config.svh
View file @
9e19b2b1
...
...
@@ -8,6 +8,9 @@
`define
WB_DATA_WIDTH 32
`define
WB_TAG_WIDTH 0
// in bits
`define
STREAM_SIZE 65536
`include
"ffpg_csr.svh"
`define
GET_WB_WORD_ADDR
(
WB_BYTE_ADDR
)
(
WB_BYTE_ADDR
/(`
WB_DATA_WIDTH
/
8
))
...
...
hdl/ffpg/sim/testbench/Testbench.sv
View file @
9e19b2b1
...
...
@@ -70,8 +70,9 @@ module Testbench;
initial
begin
:
mainTest
uvm_config_db
#(
virtual
FFPGInterface
)
::
set
(
null
,
"uvm_test_top.*"
,
"dut_vi"
,
LocalInterface
)
;
uvm_top
.
finish_on_completion
=
0
;
// not to finish when GUI is used
run_test
(
"TestTriggerAdc"
)
;
//run_test("TestDelayConfiguration");
// run_test("TestTriggerAdc");
// run_test("TestDelayConfiguration");
run_test
(
"TestPulseGeneration"
)
;
$
stop
()
;
end
...
...
hdl/ffpg/sim/testbench/TestbenchPackage.sv
View file @
9e19b2b1
...
...
@@ -298,6 +298,100 @@ package TestbenchPackage;
endclass
class
SeqSetChannel
extends
uvm_sequence
#(
td_wb_tx
)
;
`uvm_object_utils
(
SeqSetChannel
)
rand
int
Channel
;
rand
int
Overflow
;
rand
logic
[
`WB_DATA_WIDTH
-
1
:
0
]
SetData
[
0
:
(
`STREAM_SIZE
/
`WB_DATA_WIDTH
)
-
1
]
;
rand
logic
[
`WB_DATA_WIDTH
-
1
:
0
]
ResData
[
0
:
(
`STREAM_SIZE
/
`WB_DATA_WIDTH
)
-
1
]
;
constraint
ChannelConstraint
{
Channel
inside
{
[
1
:
2
]
};
}
constraint
OverflowConstraint
{
Overflow
inside
{
[
0
:
`STREAM_SIZE
-
1
]
};
}
function
new
(
string
name
=
""
)
;
super
.
new
(
name
)
;
endfunction
task
body
;
td_wb_tx
tx
;
int
SetMemBaseAddress
=
(
Channel
==
1
)
?
`GET_WB_WORD_ADDR
(
`BASE_FFPG_CH1_SET_MEM
)
:
`GET_WB_WORD_ADDR
(
`BASE_FFPG_CH2_SET_MEM
)
;
int
ResMemBaseAddress
=
(
Channel
==
1
)
?
`GET_WB_WORD_ADDR
(
`BASE_FFPG_CH1_RES_MEM
)
:
`GET_WB_WORD_ADDR
(
`BASE_FFPG_CH2_RES_MEM
)
;
int
OverflowInWords
=
(
Overflow
/
`WB_DATA_WIDTH
)
+
1
;
// configure overflow
tx
=
td_wb_tx
::
type_id
::
create
(
"tx"
)
;
start_item
(
tx
)
;
assert
(
tx
.
randomize
())
;
tx
.
direction_e
=
WB_B3_DIR_WRITE
;
tx
.
address
=
`GET_WB_WORD_ADDR
(
`ADDR_FFPG_OVERFLOW
)
;
tx
.
data
=
Overflow
;
finish_item
(
tx
)
;
assert
(
tx
.
response_e
==
WB_B3_RESPONSE_ACK_OK
)
;
// configure Set and Res data
for
(
int
i
=
0
;
i
<
OverflowInWords
;
i
++
)
begin
// SetData
tx
=
td_wb_tx
::
type_id
::
create
(
"tx"
)
;
start_item
(
tx
)
;
assert
(
tx
.
randomize
())
;
tx
.
direction_e
=
WB_B3_DIR_WRITE
;
tx
.
address
=
SetMemBaseAddress
+
i
;
tx
.
data
=
SetData
[
i
]
;
finish_item
(
tx
)
;
assert
(
tx
.
response_e
==
WB_B3_RESPONSE_ACK_OK
)
;
// ResData
tx
=
td_wb_tx
::
type_id
::
create
(
"tx"
)
;
start_item
(
tx
)
;
assert
(
tx
.
randomize
())
;
tx
.
direction_e
=
WB_B3_DIR_WRITE
;
tx
.
address
=
ResMemBaseAddress
+
i
;
tx
.
data
=
ResData
[
i
]
;
finish_item
(
tx
)
;
assert
(
tx
.
response_e
==
WB_B3_RESPONSE_ACK_OK
)
;
end
// #100; // ??
endtask
endclass
class
SeqStartChannel
extends
uvm_sequence
#(
td_wb_tx
)
;
`uvm_object_utils
(
SeqStartChannel
)
rand
int
Channel
;
constraint
ChannelConstraint
{
Channel
inside
{
[
1
:
2
]
};
}
function
new
(
string
name
=
""
)
;
super
.
new
(
name
)
;
endfunction
task
body
;
td_wb_tx
tx
;
int
Position
=
(
Channel
==
1
)
?
`FFPG_CONTROL_CH1_MODE_OFFSET
:
`FFPG_CONTROL_CH2_MODE_OFFSET
;
tx
=
td_wb_tx
::
type_id
::
create
(
"tx"
)
;
start_item
(
tx
)
;
assert
(
tx
.
randomize
())
;
tx
.
direction_e
=
WB_B3_DIR_WRITE
;
tx
.
address
=
`GET_WB_WORD_ADDR
(
`ADDR_FFPG_CONTROL
)
;
tx
.
data
=
1
<<
Position
;
finish_item
(
tx
)
;
assert
(
tx
.
response_e
==
WB_B3_RESPONSE_ACK_OK
)
;
endtask
endclass
class
TestBase
extends
uvm_test
;
`uvm_component_utils
(
TestBase
)
...
...
@@ -375,4 +469,42 @@ package TestbenchPackage;
endclass
class
TestPulseGeneration
extends
TestBase
;
`uvm_component_utils
(
TestPulseGeneration
)
function
new
(
string
name
,
uvm_component
parent
)
;
super
.
new
(
name
,
parent
)
;
endfunction
function
void
build_phase
(
uvm_phase
phase
)
;
super
.
build_phase
(
phase
)
;
endfunction
task
run_phase
(
uvm_phase
phase
)
;
SeqSetChannel
SeqSet
;
SeqStartChannel
SeqStart
;
phase
.
raise_objection
(
this
)
;
#
100
;
// configure channel
SeqSet
=
SeqSetChannel
::
type_id
::
create
(
"SeqSet"
)
;
assert
(
SeqSet
.
randomize
())
;
SeqSet
.
start
(
Env_h
.
WbAgent
.
seqr
)
;
#
100
;
// start channel
SeqStart
=
SeqStartChannel
::
type_id
::
create
(
"SeqStart"
)
;
assert
(
SeqStart
.
randomize
())
;
SeqStart
.
Channel
=
SeqSet
.
Channel
;
SeqStart
.
start
(
Env_h
.
WbAgent
.
seqr
)
;
#
1000
;
phase
.
drop_objection
(
this
)
;
endtask
endclass
endpackage
\ No newline at end of file
hdl/ffpg/sim/testbench/sim
View file @
9e19b2b1
...
...
@@ -5,8 +5,8 @@ add wave -group DUT sim:/Testbench/dut/cFfpgCore/*
add wave -group WbSlave -r sim:/Testbench/dut/cFfpgCore/cWbSlaveWrapper/*
add wave -group DacsController sim:/Testbench/dut/cFfpgCore/cDacsController/*
add wave -group DelayController -r sim:/Testbench/dut/cFfpgCore/cDelayController/*
add wave -group DelayedPulseGenerator -r sim:/Testbench/dut/cFfpgCore/cDelayedPulseGeneratorCh1/*
add wave -group DelayedPulseGenerator -r sim:/Testbench/dut/cFfpgCore/cDelayedPulseGeneratorCh2/*
add wave -group DelayedPulseGenerator
Ch1
-r sim:/Testbench/dut/cFfpgCore/cDelayedPulseGeneratorCh1/*
add wave -group DelayedPulseGenerator
Ch2
-r sim:/Testbench/dut/cFfpgCore/cDelayedPulseGeneratorCh2/*
configure wave -namecolwidth 217
configure wave -valuecolwidth 100
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment