Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL RS485 - Gateware
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Conv TTL RS485 - Gateware
Commits
1a7fbc68
Commit
1a7fbc68
authored
Feb 26, 2018
by
Denia Bouhired-Ferrag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LOCAL small mods to simulations
parent
198e95b5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
65 deletions
+114
-65
conv-common-gw
ip_cores/conv-common-gw
+1
-1
tb_run.do
sim/tb_run.do
+1
-1
testbench.vhd
sim/testbench.vhd
+14
-2
conv_ttl_rs485.xise
syn/Release/conv_ttl_rs485.xise
+62
-45
conv_ttl_rs485.vhd
top/conv_ttl_rs485.vhd
+36
-16
No files found.
conv-common-gw
@
e65f9b5f
Subproject commit
1fbe6c0a88be2a99efa363465e69cafed9f5c2ec
Subproject commit
e65f9b5fe803086ff8f02f5dbc7bd1fa87f74cd3
sim/tb_run.do
View file @
1a7fbc68
...
...
@@ -68,7 +68,7 @@ do {testbench.udo}
#
# Run simulation for this time
#
run 2
ms
run 2ms
#
# End
#
\ No newline at end of file
sim/testbench.vhd
View file @
1a7fbc68
...
...
@@ -87,6 +87,8 @@ architecture behav of testbench is
signal
in_out_oppos
,
in_out_same
:
cnt_ch_array
;
signal
pulse_cnt_ttl
,
pulse_cnt_rs485
:
cnt_ch_array
;
signal
inv_err
:
cnt_ch_array
;
signal
test_id
:
string
(
7
downto
1
);
type
cnt_inv_ch_array
is
array
(
C_NR_INV_CHANS
-1
downto
0
)
of
integer
;
...
...
@@ -423,6 +425,7 @@ begin
---------------------------------------------------------------------------
-- I2C readings
test_id
<=
"TEST 1 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 01: I2C reg reading"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -437,6 +440,7 @@ begin
---------------------------------------------------------------------------
-- I2C writing
test_id
<=
"TEST 2 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 02: I2C reg writing"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -451,6 +455,7 @@ begin
---------------------------------------------------------------------------
-- Pulses to the front TTL input
test_id
<=
"TEST 3 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 03: Sending TTL pulses and checking the outputs"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -492,6 +497,7 @@ begin
---------------------------------------------------------------------------
-- Counters reading
test_id
<=
"TEST 4 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 04: Reading of the pulse counters through I2C"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -536,6 +542,7 @@ begin
---------------------------------------------------------------------------
-- Pulses to the rear RS485 input
test_id
<=
"TEST 5 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 05: Sending pulses to the RS485 and checking the outputs"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -570,6 +577,7 @@ begin
---------------------------------------------------------------------------
-- Counters reading
test_id
<=
"TEST 6 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 06: Reading of the pulse counters through I2C"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -594,6 +602,7 @@ begin
---------------------------------------------------------------------------
-- Timetag reading
test_id
<=
"TEST 7 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 07: Reading of the timetag register through I2C"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -616,6 +625,7 @@ begin
---------------------------------------------------------------------------
-- INV channels
test_id
<=
"TEST 8 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 08: INV channel check"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -637,6 +647,7 @@ begin
---------------------------------------------------------------------------
-- Glitch filter test
test_id
<=
"TEST 9 "
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 09: Test Glitch filter"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -648,7 +659,7 @@ begin
settings_config
(
glitch_filter_en
,
ttl_out_bar_en
,
sw_gp_n_in
,
sw_other_in
,
pcbrev
,
rtm_in
);
wait
for
2
us
;
-- ML: does not work without this wait, no idea way?
print_now_s_i
(
"Sending pulses 50ns-long each to TTL_N_I(3): "
,
nb_pulses_to_send_fp
);
generate_pulse
(
ttl_n_in
(
3
),
nb_pulses_to_send_fp
,
"fp"
,
rs485_fs_n_in
(
3
),
50
ns
,
2
0
ns
);
generate_pulse
(
ttl_n_in
(
3
),
nb_pulses_to_send_fp
,
"fp"
,
rs485_fs_n_in
(
3
),
50
ns
,
5
0
ns
);
-- Checking if any pulse was passed to the output
print_now
(
"Check that the glitches were filtered and there is no pulse in the TTL_O(3) output"
);
...
...
@@ -664,6 +675,7 @@ begin
---------------------------------------------------------------------------
-- TTL bar test
test_id
<=
"TEST 10"
;
print_now
(
"----------------------------------------------------------------"
);
print_now
(
"---> Test 10: Test TTL BAR"
);
print_now
(
"----------------------------------------------------------------"
);
...
...
@@ -681,7 +693,7 @@ begin
-- Check if TTL_N_IN out and TTL_O out are the same
print_now
(
"Check that TTL_O(5) matches TTL_N_IN(5)"
);
if
in_out_
same
(
5
)
=
0
then
if
in_out_
oppos
(
5
)
=
0
then
print_now
(
"[OK] TTL_O(5) matches TTL_N_IN(5)"
);
else
print_now
(
"[ERR] TTL_O(5) does not match TTL_N_IN(5)"
);
...
...
syn/Release/conv_ttl_rs485.xise
View file @
1a7fbc68
This diff is collapsed.
Click to expand it.
top/conv_ttl_rs485.vhd
View file @
1a7fbc68
...
...
@@ -49,6 +49,7 @@ use work.wishbone_pkg.all;
use
work
.
conv_common_gw_pkg
.
all
;
entity
conv_ttl_rs485
is
generic
(
g_simul
:
boolean
:
=
FALSE
);
port
(
-- Clocks
...
...
@@ -188,6 +189,7 @@ architecture arch of conv_ttl_rs485 is
signal
inv_pulse_out
:
std_logic_vector
(
c_nr_inv_chans
-1
downto
0
);
signal
pulse_ttl
:
std_logic_vector
(
c_nr_chans
-1
downto
0
);
signal
pulse_rs485
:
std_logic_vector
(
c_nr_chans
-1
downto
0
);
signal
pulse_rs485_mapped
:
std_logic_vector
(
c_nr_chans
-1
downto
0
);
signal
inhibit_first_pulse
:
std_logic
;
signal
inhibit_first_pulse_d0
:
std_logic
;
signal
inhibit_cnt
:
unsigned
(
10
downto
0
);
...
...
@@ -272,12 +274,20 @@ begin
pulse_ttl
<=
not
ttl_n_i
when
sw_ttl
=
'1'
else
ttl_n_i
and
(
not
ttlbar_nosig
);
-- Pulse input on RS-485 side valid only when failsafe not high
-- see Texas slyt257 for implementation details
gen_rs485_input
:
for
i
in
0
to
c_nr_chans
-1
generate
rs485_fs
(
i
)
<=
rs485_n_i
(
i
)
nor
rs485_fs_n_i
(
i
);
pulse_rs485
(
i
)
<=
(
not
rs485_n_i
(
i
))
when
rs485_fs
(
i
)
=
'0'
else
'0'
;
pulse_rs485_mapped
(
i
)
<=
(
not
rs485_n_i
(
i
))
when
rs485_fs
(
i
)
=
'0'
else
'0'
;
pulse_rs485
(
0
)
<=
pulse_rs485_mapped
(
0
);
pulse_rs485
(
1
)
<=
pulse_rs485_mapped
(
4
)
when
rtmp_i
=
"101"
else
pulse_rs485_mapped
(
1
);
pulse_rs485
(
2
)
<=
pulse_rs485_mapped
(
2
)
when
rtmp_i
=
"101"
else
pulse_rs485_mapped
(
2
);
pulse_rs485
(
3
)
<=
pulse_rs485_mapped
(
3
)
when
rtmp_i
=
"101"
else
pulse_rs485_mapped
(
3
);
pulse_rs485
(
4
)
<=
pulse_rs485_mapped
(
4
)
when
rtmp_i
=
"101"
else
pulse_rs485_mapped
(
4
);
pulse_rs485
(
5
)
<=
pulse_rs485_mapped
(
5
)
when
rtmp_i
=
"101"
else
pulse_rs485_mapped
(
5
);
end
generate
gen_rs485_input
;
...
...
@@ -335,7 +345,7 @@ begin
cmp_conv_common
:
conv_common_gw
generic
map
(
-- Number of repeater channels
g_simul
=>
g_simul
,
g_nr_chans
=>
c_nr_chans
,
g_board_id
=>
c_board_id
,
g_gwvers
=>
c_gwvers
,
...
...
@@ -470,25 +480,35 @@ begin
bicolor_led_line_oen_o
=>
bicolor_led_line_oen
);
--============================================================================
-- Channel output logic
--============================================================================
-- Front and rear panel outputs
ttl_o
<=
pulse_out
when
sw_ttl
=
'1'
else
not
pulse_out
;
rs485_o
(
1
downto
0
)
<=
pulse_out
(
1
downto
0
);
-- ttl_o <= pulse_out when sw_ttl = '1' else
-- not pulse_out;
-- rs485_o (1 downto 0) <= pulse_out (1 downto 0);
-- Channels 3 and 4 output copies of chans 1 and 2 respectively
-- depending on RTMP Id of RTM connected.
--
*RTM with DB9 connectors has only 2 o/p channels in rs485 RTMP = Gnd Open Gnd
--
*Optical RTM only 2 o/p channels in optical RTMP= Open Open Gnd
--
*RTM with DB9 connectors has only 2 o/p channels in rs485 RTMP = Gnd Open Gnd
--
*Optical RTM only 2 o/p channels in optical RTMP= Open Open Gnd
-- in these cases channel 3 copies channel 1
-- channel 4 copies channel 2
rs485_o
(
3
downto
2
)
<=
pulse_out
(
1
downto
0
)
when
rtmp_i
=
"101"
or
rtmp_i
=
"100"
else
pulse_out
(
3
downto
2
);
rs485_o
(
5
downto
4
)
<=
pulse_out
(
5
downto
4
);
-- channel 4 copies channel 2
-- rs485_o (3 downto 2) <= pulse_out (1 downto 0) when rtmp_i = "101" or rtmp_i = "100"
-- else pulse_out (3 downto 2);
-- rs485_o (5 downto 4) <= pulse_out (5 downto 4);
--============================================================================
-- Channel output logic
--============================================================================
-- Front and rear panel outputs
rs485_o
(
0
)
<=
pulse_out
(
0
);
rs485_o
(
1
)
<=
pulse_out
(
0
)
when
rtmp_i
=
"101"
else
pulse_out
(
1
);
rs485_o
(
2
)
<=
pulse_out
(
2
);
rs485_o
(
3
)
<=
pulse_out
(
3
);
rs485_o
(
4
)
<=
pulse_out
(
1
)
when
rtmp_i
=
"101"
else
pulse_out
(
4
);
rs485_o
(
5
)
<=
pulse_out
(
1
)
when
rtmp_i
=
"101"
else
pulse_out
(
5
);
-- LED outputs
-- Boards earlier than v4 do not use -ve logic for LEDs.
-- For these LED pulse signals are still in +ve logic.
...
...
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