Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Platform-independent core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
Platform-independent core collection
Commits
02a5a17b
Commit
02a5a17b
authored
Sep 27, 2017
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sim: import and update bicolor LED controller testbench from SVEC project
parent
338eeed9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
308 additions
and
0 deletions
+308
-0
.gitignore
testbench/common/gc_bicolor_led_ctrl/.gitignore
+2
-0
Manifest.py
testbench/common/gc_bicolor_led_ctrl/Manifest.py
+18
-0
gc_bicolor_led_ctrl_tb.vhd
...nch/common/gc_bicolor_led_ctrl/gc_bicolor_led_ctrl_tb.vhd
+237
-0
run.do
testbench/common/gc_bicolor_led_ctrl/run.do
+12
-0
wave.do
testbench/common/gc_bicolor_led_ctrl/wave.do
+39
-0
No files found.
testbench/common/gc_bicolor_led_ctrl/.gitignore
0 → 100644
View file @
02a5a17b
transcript
Makefile
testbench/common/gc_bicolor_led_ctrl/Manifest.py
0 → 100644
View file @
02a5a17b
action
=
"simulation"
sim_tool
=
"modelsim"
target
=
"xilinx"
syn_device
=
"xc6slx45t"
top_module
=
"gc_bicolor_led_ctrl_tb"
# for hdlmake2
sim_top
=
"gc_bicolor_led_ctrl_tb"
# for hdlmake3
files
=
[
"gc_bicolor_led_ctrl_tb.vhd"
,
]
modules
=
{
"local"
:
[
"../../../"
,
],
}
testbench/common/gc_bicolor_led_ctrl/gc_bicolor_led_ctrl_tb.vhd
0 → 100644
View file @
02a5a17b
--------------------------------------------------------------------------------
-- CERN (BE-CO-HT)
-- Bi-color LED controller testbench
-- http://www.ohwr.org/projects/svec
--------------------------------------------------------------------------------
--
-- unit name: gc_bicolor_led_ctrl_tb
--
-- author: Matthieu Cattin (matthieu.cattin@cern.ch)
--
-- date: 12-07-2012
--
-- version: 1.0
--
-- description: Bi-color LED controller testbench.
--
-- dependencies:
--
--------------------------------------------------------------------------------
-- GNU LESSER GENERAL PUBLIC LICENSE
--------------------------------------------------------------------------------
-- This source file is free software; you can redistribute it and/or modify it
-- under the terms of the GNU Lesser General Public License as published by the
-- Free Software Foundation; either version 2.1 of the License, or (at your
-- option) any later version. This source is distributed in the hope that it
-- will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU Lesser General Public License for more details. You should have
-- received a copy of the GNU Lesser General Public License along with this
-- source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
--------------------------------------------------------------------------------
-- last changes: see log.
--------------------------------------------------------------------------------
-- TODO: -
--------------------------------------------------------------------------------
library
IEEE
;
use
IEEE
.
STD_LOGIC_1164
.
all
;
use
IEEE
.
NUMERIC_STD
.
all
;
library
work
;
use
work
.
gencores_pkg
.
all
;
entity
gc_bicolor_led_ctrl_tb
is
end
gc_bicolor_led_ctrl_tb
;
architecture
tb
of
gc_bicolor_led_ctrl_tb
is
------------------------------------------------------------------------------
-- Types declaration
------------------------------------------------------------------------------
type
t_led_color
is
(
OFF
,
RED
,
GREEN
,
UNDEF
);
type
t_led_color_array
is
array
(
0
to
7
)
of
t_led_color
;
------------------------------------------------------------------------------
-- Constants declaration
------------------------------------------------------------------------------
constant
c_NB_LINE
:
natural
:
=
3
;
constant
c_NB_COLUMN
:
natural
:
=
4
;
constant
c_CLK_FREQ
:
natural
:
=
125000000
;
-- in Hz
constant
c_REFRESH_RATE
:
natural
:
=
250
;
-- in Hz
------------------------------------------------------------------------------
-- Signals declaration
------------------------------------------------------------------------------
signal
rst_n_i
:
std_logic
:
=
'1'
;
signal
clk_i
:
std_logic
:
=
'0'
;
signal
led_intensity_i
:
std_logic_vector
(
6
downto
0
)
:
=
(
others
=>
'0'
);
signal
led_state_i
:
std_logic_vector
((
c_NB_LINE
*
c_NB_COLUMN
*
2
)
-
1
downto
0
)
:
=
(
others
=>
'0'
);
signal
column_o
:
std_logic_vector
(
c_NB_COLUMN
-
1
downto
0
);
signal
line_o
:
std_logic_vector
(
c_NB_LINE
-
1
downto
0
);
signal
line_oen_o
:
std_logic_vector
(
c_NB_LINE
-
1
downto
0
);
signal
led_color
:
t_led_color_array
;
begin
-- Instantiate the Unit Under Test (UUT)
uut
:
gc_bicolor_led_ctrl
generic
map
(
g_NB_COLUMN
=>
c_NB_COLUMN
,
g_NB_LINE
=>
c_NB_LINE
,
g_CLK_FREQ
=>
c_CLK_FREQ
,
g_REFRESH_RATE
=>
c_REFRESH_RATE
)
port
map
(
rst_n_i
=>
rst_n_i
,
clk_i
=>
clk_i
,
led_intensity_i
=>
led_intensity_i
,
led_state_i
=>
led_state_i
,
column_o
=>
column_o
,
line_o
=>
line_o
,
line_oen_o
=>
line_oen_o
);
-- Clock process definitions
clk_i_process
:
process
begin
clk_i
<=
'0'
;
wait
for
4
ns
;
clk_i
<=
'1'
;
wait
for
4
ns
;
end
process
;
-- check color
p_led_color_check
:
process
begin
wait
until
(
line_oen_o
'event
or
line_o
'event
or
column_o
'event
);
if
(
line_oen_o
(
0
)
=
'0'
or
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
column_o
(
0
)))
then
led_color
(
0
)
<=
OFF
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'1'
and
column_o
(
0
)
=
'0'
)
then
led_color
(
0
)
<=
RED
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'0'
and
column_o
(
0
)
=
'1'
)
then
led_color
(
0
)
<=
GREEN
;
else
led_color
(
0
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
0
)
=
'0'
or
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
column_o
(
1
)))
then
led_color
(
1
)
<=
OFF
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'1'
and
column_o
(
1
)
=
'0'
)
then
led_color
(
1
)
<=
RED
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'0'
and
column_o
(
1
)
=
'1'
)
then
led_color
(
1
)
<=
GREEN
;
else
led_color
(
1
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
0
)
=
'0'
or
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
column_o
(
2
)))
then
led_color
(
2
)
<=
OFF
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'1'
and
column_o
(
2
)
=
'0'
)
then
led_color
(
2
)
<=
RED
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'0'
and
column_o
(
2
)
=
'1'
)
then
led_color
(
2
)
<=
GREEN
;
else
led_color
(
2
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
0
)
=
'0'
or
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
column_o
(
3
)))
then
led_color
(
3
)
<=
OFF
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'1'
and
column_o
(
3
)
=
'0'
)
then
led_color
(
3
)
<=
RED
;
elsif
(
line_oen_o
(
0
)
=
'1'
and
line_o
(
0
)
=
'0'
and
column_o
(
3
)
=
'1'
)
then
led_color
(
3
)
<=
GREEN
;
else
led_color
(
3
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
1
)
=
'0'
or
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
column_o
(
0
)))
then
led_color
(
4
)
<=
OFF
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'1'
and
column_o
(
0
)
=
'0'
)
then
led_color
(
4
)
<=
RED
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'0'
and
column_o
(
0
)
=
'1'
)
then
led_color
(
4
)
<=
GREEN
;
else
led_color
(
4
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
1
)
=
'0'
or
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
column_o
(
1
)))
then
led_color
(
5
)
<=
OFF
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'1'
and
column_o
(
1
)
=
'0'
)
then
led_color
(
5
)
<=
RED
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'0'
and
column_o
(
1
)
=
'1'
)
then
led_color
(
5
)
<=
GREEN
;
else
led_color
(
5
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
1
)
=
'0'
or
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
column_o
(
2
)))
then
led_color
(
6
)
<=
OFF
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'1'
and
column_o
(
2
)
=
'0'
)
then
led_color
(
6
)
<=
RED
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'0'
and
column_o
(
2
)
=
'1'
)
then
led_color
(
6
)
<=
GREEN
;
else
led_color
(
6
)
<=
UNDEF
;
end
if
;
if
(
line_oen_o
(
1
)
=
'0'
or
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
column_o
(
3
)))
then
led_color
(
7
)
<=
OFF
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'1'
and
column_o
(
3
)
=
'0'
)
then
led_color
(
7
)
<=
RED
;
elsif
(
line_oen_o
(
1
)
=
'1'
and
line_o
(
1
)
=
'0'
and
column_o
(
3
)
=
'1'
)
then
led_color
(
7
)
<=
GREEN
;
else
led_color
(
7
)
<=
UNDEF
;
end
if
;
end
process
p_led_color_check
;
-- Stimulus process
stim_proc
:
process
begin
-- hold reset state for 1 us.
rst_n_i
<=
'0'
;
wait
for
1
us
;
rst_n_i
<=
'1'
;
wait
for
100
ns
;
wait
until
rising_edge
(
clk_i
);
led_intensity_i
<=
std_logic_vector
(
to_unsigned
(
100
,
led_intensity_i
'length
));
led_state_i
(
1
downto
0
)
<=
c_LED_RED
;
led_state_i
(
3
downto
2
)
<=
c_LED_OFF
;
led_state_i
(
5
downto
4
)
<=
c_LED_RED_GREEN
;
led_state_i
(
7
downto
6
)
<=
c_LED_OFF
;
led_state_i
(
9
downto
8
)
<=
c_LED_GREEN
;
led_state_i
(
11
downto
10
)
<=
c_LED_OFF
;
led_state_i
(
13
downto
12
)
<=
c_LED_OFF
;
led_state_i
(
15
downto
14
)
<=
c_LED_RED_GREEN
;
wait
for
20
ms
;
wait
until
rising_edge
(
clk_i
);
led_intensity_i
<=
std_logic_vector
(
to_unsigned
(
50
,
led_intensity_i
'length
));
wait
for
20
ms
;
wait
until
rising_edge
(
clk_i
);
led_intensity_i
<=
std_logic_vector
(
to_unsigned
(
10
,
led_intensity_i
'length
));
wait
for
20
ms
;
wait
until
rising_edge
(
clk_i
);
led_intensity_i
<=
std_logic_vector
(
to_unsigned
(
0
,
led_intensity_i
'length
));
wait
for
20
ms
;
wait
until
rising_edge
(
clk_i
);
led_intensity_i
<=
std_logic_vector
(
to_unsigned
(
120
,
led_intensity_i
'length
));
wait
;
end
process
;
end
tb
;
testbench/common/gc_bicolor_led_ctrl/run.do
0 → 100644
View file @
02a5a17b
vsim -novopt -t 1ps bicolor_led_ctrl_tb
log -r /*
do wave.do
view wave
view transcript
run 100 ms
testbench/common/gc_bicolor_led_ctrl/wave.do
0 → 100644
View file @
02a5a17b
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /bicolor_led_ctrl_tb/uut/rst_n_i
add wave -noupdate /bicolor_led_ctrl_tb/uut/clk_i
add wave -noupdate /bicolor_led_ctrl_tb/uut/led_state_i
add wave -noupdate -radix unsigned /bicolor_led_ctrl_tb/uut/led_intensity_i
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_o(0)
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_oen_o(0)
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_o(1)
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_oen_o(1)
add wave -noupdate /bicolor_led_ctrl_tb/uut/column_o(3)
add wave -noupdate /bicolor_led_ctrl_tb/uut/column_o(2)
add wave -noupdate /bicolor_led_ctrl_tb/uut/column_o(1)
add wave -noupdate /bicolor_led_ctrl_tb/uut/column_o(0)
add wave -noupdate -divider internals
add wave -noupdate -radix unsigned /bicolor_led_ctrl_tb/uut/refresh_rate_cnt
add wave -noupdate /bicolor_led_ctrl_tb/uut/refresh_rate
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_oen_cnt
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_oen
add wave -noupdate /bicolor_led_ctrl_tb/uut/line_ctrl
add wave -noupdate -radix unsigned /bicolor_led_ctrl_tb/uut/intensity_ctrl_cnt
add wave -noupdate /bicolor_led_ctrl_tb/uut/intensity_ctrl
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {281251037500 ps} 0}
configure wave -namecolwidth 295
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 ps
update
WaveRestoreZoom {279730374924 ps} {301066822373 ps}
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