OpenCores
URL https://opencores.org/ocsvn/spacewire_light/spacewire_light/trunk

Subversion Repositories spacewire_light

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 3 to Rev 2
    Reverse comparison

Rev 3 → Rev 2

/spacewire_light/trunk/doc/Manual.odt Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
spacewire_light/trunk/doc/Manual.odt Property changes : Deleted: svn:mime-type ## -1 +0,0 ## -application/octet-stream \ No newline at end of property Index: spacewire_light/trunk/doc/timing_diagram.py =================================================================== --- spacewire_light/trunk/doc/timing_diagram.py (revision 3) +++ spacewire_light/trunk/doc/timing_diagram.py (nonexistent) @@ -1,224 +0,0 @@ -#!/usr/bin/env python -# timing_diagram.py, Joris van Rantwijk, Jul 2010. - -""" -Generate timing diagrams for SpaceWire Light manual. -""" - -from pyx import * - -riseWidth = 0.15 -clockWidth = 1.0 -lowLevel = 0 -highLevel = 0.5 -midLevel = 0.25 - -def drawGrid(x, y1, y2, tstart, nclk): - - for i in xrange(nclk): - x0 = x + clockWidth * (tstart + i) - c.stroke(path.line(x0, y1, x0, y2), [ style.linewidth.Thin, color.gray(0.5) ]) - -def drawSignal(x, y, events): - - for i in xrange(len(events)-1): - (t, v) = events[i] - (tnext, vnext) = events[i+1] - - firstevt = (i == 0) - lastevt = (i == len(events) - 2) - - x0 = x + clockWidth * t - x1 = x + clockWidth * t + 0.5 * riseWidth - x2 = x + clockWidth * tnext - 0.5 * riseWidth - x3 = x + clockWidth * tnext - - # fill - if v.lower() == 'x': - p = path.path(path.moveto(x1, y + lowLevel)) - if not firstevt: - p.append(path.lineto(x0, y + midLevel)) - p.append(path.lineto(x1, y + highLevel)) - p.append(path.lineto(x2, y + highLevel)) - if not lastevt: - p.append(path.lineto(x3, y + midLevel)) - p.append(path.lineto(x2, y + lowLevel)) - p.append(path.lineto(x1, y + lowLevel)) - c.fill(p, [ color.gray(0.5) ]) - - lineStyle = [ ] - if v.lower() != 'x': - lineStyle.append(style.linewidth.Thick) - - # draw low part of signal - if v.lower() in '0vx': - p = path.path() - if firstevt: - p.append(path.moveto(x1, y + lowLevel)) - else: - p.append(path.moveto(x0, y + midLevel)) - p.append(path.lineto(x1, y + lowLevel)) - p.append(path.lineto(x2, y + lowLevel)) - if not lastevt: - p.append(path.lineto(x3, y + midLevel)) - c.stroke(p, lineStyle) - - # draw high part of signal - if v.lower() in '1vx': - p = path.path() - if firstevt: - p.append(path.moveto(x1, y + highLevel)) - else: - p.append(path.moveto(x0, y + midLevel)) - p.append(path.lineto(x1, y + highLevel)) - p.append(path.lineto(x2, y + highLevel)) - if not lastevt: - p.append(path.lineto(x3, y + midLevel)) - c.stroke(p, lineStyle) - - # draw center part of signal - if v.lower() == 'z': - p = path.path() - if firstevt: - p.append(path.moveto(x1, y + midLevel)) - else: - p.append(path.moveto(x0, y + midLevel)) - if lastevt: - p.append(path.lineto(x2, y + midLevel)) - else: - p.append(path.lineto(x3, y + midLevel)) - c.stroke(p, lineStyle) - - -th = 0.3 # an appearance of "hold time" in diagram -xstart = 1.2 - -text.set(mode='latex') - -#### Read timing - -c = canvas.canvas() - -drawGrid(xstart, 0.9, 5.5, 1, 9) - -c.text(0, 5, '\\textsf{\\textbf{CLK}}') -drawSignal(xstart, 5, - [ (0.5+i/2.0, str(i%2)) for i in range(20) ]) - -c.text(0, 4, '\\textsf{\\textbf{RXVALID}}') -drawSignal(xstart, 4, - [ (0.5, '0'), (2+th, '1'), (7+th, '0'), (10, '') ]) - -c.text(0, 3, '\\textsf{\\textbf{RXFLAG}}') -drawSignal(xstart, 3, - [ (0.5, 'x'), (2+th, 'v'), (4+th, 'v'), (6+th, 'v'), (7+th, 'x'), (10, '') ]) - -c.text(0, 2, '\\textsf{\\textbf{RXDATA}}') -drawSignal(xstart, 2, - [ (0.5, 'x'), (2+th, 'v'), (4+th, 'v'), (6+th, 'v'), (7+th, 'x'), (10, '') ]) - -c.text(0, 1, '\\textsf{\\textbf{RXREAD}}') -drawSignal(xstart, 1, - [ (0.5, '0'), (3+th, '1'), (4+th, '0'), (5+th, '1'), (8+th, '0'), (10, '') ]) - -c.stroke(path.line(xstart+4*clockWidth, 0.4, xstart+4*clockWidth, 0.8), [ deco.arrow() ]) -c.stroke(path.line(xstart+6*clockWidth, 0.4, xstart+6*clockWidth, 0.8), [ deco.arrow() ]) -c.stroke(path.line(xstart+7*clockWidth, 0.4, xstart+7*clockWidth, 0.8), [ deco.arrow() ]) - -c.writeEPSfile('timing_read.eps') - -#### Write timing - -c = canvas.canvas() - -drawGrid(xstart, 0.9, 5.5, 1, 9) - -c.text(0, 5, '\\textsf{\\textbf{CLK}}') -drawSignal(xstart, 5, - [ (0.5+i/2.0, str(i%2)) for i in range(20) ]) - -c.text(0, 4, '\\textsf{\\textbf{TXRDY}}') -drawSignal(xstart, 4, - [ (0.5, '1'), (5+th, '0'), (6+th, '1'), (9+th, '0'), (10, '') ]) - -c.text(0, 3, '\\textsf{\\textbf{TXWRITE}}') -drawSignal(xstart, 3, - [ (0.5, '0'), (2+th, '1'), (3+th, '0'), (4+th, '1'), (8+th, '0'), (10, '') ]) - -c.text(0, 2, '\\textsf{\\textbf{TXFLAG}}') -drawSignal(xstart, 2, - [ (0.5, 'x'), (2+th, 'v'), (3+th, 'x'), (4+th, 'v'), (5+th, 'v'), - (7+th, 'v'), (8+th, 'x'), (10, '') ]) - -c.text(0, 1, '\\textsf{\\textbf{TXDATA}}') -drawSignal(xstart, 1, - [ (0.5, 'x'), (2+th, 'v'), (3+th, 'x'), (4+th, 'v'), (5+th, 'v'), - (7+th, 'v'), (8+th, 'x'), (10, '') ]) - -c.stroke(path.line(xstart+3*clockWidth, 0.4, xstart+3*clockWidth, 0.8), [ deco.arrow() ]) -c.stroke(path.line(xstart+5*clockWidth, 0.4, xstart+5*clockWidth, 0.8), [ deco.arrow() ]) -c.stroke(path.line(xstart+7*clockWidth, 0.4, xstart+7*clockWidth, 0.8), [ deco.arrow() ]) -c.stroke(path.line(xstart+8*clockWidth, 0.4, xstart+8*clockWidth, 0.8), [ deco.arrow() ]) - -c.writeEPSfile('timing_write.eps') - -#### Time codes - -c = canvas.canvas() - -xstart = 1.4 - -drawGrid(xstart, 0, 6.5, 1, 9) - -c.text(0, 6, '\\textsf{\\textbf{CLK}}') -drawSignal(xstart, 6, - [ (0.5+i/2.0, str(i%2)) for i in range(20) ]) - -c.text(0, 5, '\\textsf{\\textbf{TICK\_OUT}}') -drawSignal(xstart, 5, - [ (0.5, '0'), (2+th, '1'), (3+th, '0'), (5+th, '1'), (6+th, '0'), (10, '') ]) - -c.text(0, 4, '\\textsf{\\textbf{CTRL\_OUT}}') -drawSignal(xstart, 4, [ (0.5, 'x'), (2+th, 'v'), (5+th, 'v'), (10, '') ]) - -c.text(0, 3, '\\textsf{\\textbf{TIME\_OUT}}') -drawSignal(xstart, 3, [ (0.5, 'x'), (2+th, 'v'), (5+th, 'v'), (10, '') ]) - -c.text(0, 2, '\\textsf{\\textbf{TICK\_IN}}') -drawSignal(xstart, 2, [ (0.5, '0'), (7+th, '1'), (8+th, '0'), (10, '') ]) - -c.text(0, 1, '\\textsf{\\textbf{CTRL\_IN}}') -drawSignal(xstart, 1, [ (0.5, 'x'), (7+th, 'v'), (8+th, 'x'), (10, '') ]) - -c.text(0, 0, '\\textsf{\\textbf{TIME\_IN}}') -drawSignal(xstart, 0, [ (0.5, 'x'), (7+th, 'v'), (8+th, 'x'), (10, '') ]) - -c.writeEPSfile('timing_timecode.eps') - -#### Link status - -c = canvas.canvas() - -clockWidth = 0.8 -xstart = 1.6 - -c.text(0, 5, '\\textsf{\\textbf{LINKSTART}}') -drawSignal(xstart, 5, [ (1, '0'), (2, '1'), (10, '0'), (19, '') ]) - -c.text(0, 4, '\\textsf{\\textbf{STARTED}}') -drawSignal(xstart, 4, [ (1, '0'), (4, '1'), (6, '0'), (19, '') ]) - -c.text(0, 3, '\\textsf{\\textbf{CONNECTING}}') -drawSignal(xstart, 3, [ (1, '0'), (6, '1'), (8, '0'), (19, '') ]) - -c.text(0, 2, '\\textsf{\\textbf{RUNNING}}') -drawSignal(xstart, 2, [ (1, '0'), (8, '1'), (16, '0'), (19, '') ]) - -c.text(0, 1, '\\textsf{\\textbf{ERRPAR}}') -drawSignal(xstart, 1, [ (1, '0'), (15.5, '1'), (16.5, '0'), (19, '') ]) - -c.stroke(path.line(xstart+6*clockWidth, 4.8, xstart+6*clockWidth, 2.6), [ style.linewidth.Thin ]) -c.stroke(path.line(xstart+8*clockWidth, 3.8, xstart+8*clockWidth, 1.6), [ style.linewidth.Thin ]) - -c.writeEPSfile('timing_link.eps') - Index: spacewire_light/trunk/bench/vhdl/streamtest_tb.vhd =================================================================== --- spacewire_light/trunk/bench/vhdl/streamtest_tb.vhd (revision 3) +++ spacewire_light/trunk/bench/vhdl/streamtest_tb.vhd (revision 2) @@ -28,7 +28,6 @@ component streamtest is generic ( sysfreq: real; - txclkfreq: real; tickdiv: integer range 12 to 24 := 20; rximpl: spw_implementation_type := impl_generic; rxchunk: integer range 1 to 4 := 1; @@ -85,7 +84,6 @@ streamtest_inst: streamtest generic map ( sysfreq => sys_clock_freq, - txclkfreq => sys_clock_freq, tickdiv => 16, rximpl => impl_generic, rxchunk => 1, Index: spacewire_light/trunk/rtl/vhdl/spwstream.vhd =================================================================== --- spacewire_light/trunk/rtl/vhdl/spwstream.vhd (revision 3) +++ spacewire_light/trunk/rtl/vhdl/spwstream.vhd (revision 2) @@ -11,7 +11,7 @@ -- -- The SpaceWire standard requires that each transceiver use an initial -- signalling rate of 10 Mbit/s. This implies that the system clock frequency --- must be a multiple of 10 MHz. See the manual for further details on +-- must be a multiple of 10 MHz. See the datasheet for further details on -- bitrates and clocking. -- @@ -26,14 +26,9 @@ -- System clock frequency in Hz. -- This must be set to the frequency of "clk". It is used to setup -- counters for reset timing, disconnect timeout and to transmit - -- at 10 Mbit/s during the link handshake. + -- at 10 Mbit/s during the handshake. sysfreq: real; - -- Transmit clock frequency in Hz (only if tximpl = impl_fast). - -- This must be set to the frequency of "txclk". It is used to - -- transmit at 10 Mbit/s during the link handshake. - txclkfreq: real := 0.0; - -- Selection of a receiver front-end implementation. rximpl: spw_implementation_type := impl_generic; @@ -72,13 +67,12 @@ -- Without autostart or linkstart, the link remains in state Ready. linkstart: in std_logic; - -- Do not start link (overrides linkstart and autostart) and/or - -- disconnect a running link. + -- Do not start link (overrides linkstart and autostart) and/or disconnect + -- if the link is in state Run. linkdis: in std_logic; - -- Scaling factor minus 1, used to scale the transmit base clock into - -- the transmission bit rate. The system clock (for impl_generic) or - -- the txclk (for impl_fast) is divided by (unsigned(txdivcnt) + 1). + -- Scaling factor minus 1, used to scale the system clock into the transmission + -- signalling rate. The system clock is divided by (unsigned(divcnt) + 1). -- Changing this signal will immediately change the transmission rate. -- During link setup, the transmission rate is always 10 Mbit/s. txdivcnt: in std_logic_vector(7 downto 0); @@ -199,12 +193,8 @@ constant disconnect_time: integer := integer(sysfreq * 850.0e-9); -- Initial tx clock scaler (10 Mbit). - type impl_to_real_type is array(spw_implementation_type) of real; - constant tximpl_to_txclk_freq: impl_to_real_type := - (impl_generic => sysfreq, impl_fast => txclkfreq); - constant effective_txclk_freq: real := tximpl_to_txclk_freq(tximpl); constant default_divcnt: std_logic_vector(7 downto 0) := - std_logic_vector(to_unsigned(integer(effective_txclk_freq / 10.0e6 - 1.0), 8)); + std_logic_vector(to_unsigned(integer(sysfreq / 10.0e6 - 1.0), 8)); -- Registers. type regs_type is record
/spacewire_light/trunk/rtl/vhdl/spwxmit_fast.vhd
122,7 → 122,7
-- no problem there.
--
-- This is different when the data stream includes 4-bit tokens.
-- See the manual for further comments.
-- See the datasheet for an analysis of that case.
--
-- Implementation guidelines
-- -------------------------
200,7 → 200,6
type token_type is record
tick: std_ulogic; -- send time code
fct: std_ulogic; -- send FCT
fctpiggy: std_ulogic; -- send FCT and N-char
flag: std_ulogic; -- send EOP or EEP
char: std_logic_vector(7 downto 0); -- character or time code
end record;
221,7 → 220,6
b_token: token_type;
-- stage C
c_update: std_ulogic;
c_busy: std_ulogic;
c_esc: std_ulogic;
c_fct: std_ulogic;
c_bits: std_logic_vector(8 downto 0);
279,12 → 277,6
end record;
 
-- Initial state of system clock domain
constant token_reset: token_type := (
tick => '0',
fct => '0',
fctpiggy => '0',
flag => '0',
char => (others => '0') );
constant regs_reset: regs_type := (
txenreg => '0',
txdivreg => (others => '0'),
293,8 → 285,8
txdivsafe => '0',
sysflip0 => '0',
sysflip1 => '0',
token0 => token_reset,
token1 => token_reset,
token0 => ( tick => '0', fct => '0', flag => '0', char => (others => '0') ),
token1 => ( tick => '0', fct => '0', flag => '0', char => (others => '0') ),
tokmux => '0',
txflip0 => "00",
txflip1 => "00",
344,7 → 336,7
vtx := rtx;
v_needtoken := '0';
v_havetoken := '0';
v_token := token_reset;
v_token := ( tick => '0', fct => '0', flag => '0', char => (others => '0') );
 
-- ---- FAST CLOCK DOMAIN ----
 
357,9 → 349,9
-- Stage B: Multiplex tokens from system clock domain.
-- Update stage B three bit periods after updating stage C
-- (i.e. in time for the next update of stage C).
-- Do not update stage B if stage C is indicating that it needs to
-- send a second token to complete its task.
vtx.b_update := rtx.txclken and rtx.e_count(0) and (not rtx.c_busy);
-- Do not update stage B if the last token from stage C was ESC;
-- stage C already knows what token to put after the ESC.
vtx.b_update := rtx.txclken and rtx.e_count(0) and (not rtx.c_esc);
if rtx.b_mux = '0' then
vtx.b_txflip := rtx.txflip0;
else
388,26 → 380,11
-- Stage C: Prepare to transmit EOP, EEP or a data character.
vtx.c_update := rtx.txclken and rtx.e_count(3);
if rtx.c_update = '1' then
 
-- NULL is broken into two tokens: ESC + FCT.
-- Time-codes are broken into two tokens: ESC + char.
 
-- Enable c_esc on the first pass of a NULL or a time-code.
-- NULL is broken into two tokens: ESC + FCT
-- time codes are broken into two tokens: ESC + char
vtx.c_esc := (rtx.b_token.tick or (not rtx.b_valid)) and
(not rtx.c_esc);
 
-- Enable c_fct on the first pass of an FCT and on
-- the second pass of a NULL (also the first pass, but c_esc
-- is stronger than c_fct).
vtx.c_fct := (rtx.b_token.fct and (not rtx.c_busy)) or
(not rtx.b_valid);
 
-- Enable c_busy on the first pass of a NULL or a time-code
-- or a piggy-backed FCT. This will tell stage B that we are
-- not done yet.
vtx.c_busy := (rtx.b_token.tick or (not rtx.b_valid) or
rtx.b_token.fctpiggy) and (not rtx.c_busy);
 
vtx.c_fct := rtx.b_token.fct or (not rtx.b_valid);
if rtx.b_token.flag = '1' then
if rtx.b_token.char(0) = '0' then
-- prepare to send EOP
516,7 → 493,6
vtx.b_mux := '0';
vtx.b_valid := '0';
vtx.c_update := '0';
vtx.c_busy := '1';
vtx.c_esc := '1'; -- need to send 2nd part of NULL
vtx.c_fct := '1';
vtx.d_bits := "000000111"; -- ESC = P111
608,7 → 584,6
-- prepare to send time code
v_token.tick := '1';
v_token.fct := '0';
v_token.fctpiggy := '0';
v_token.flag := '0';
v_token.char := r.pend_time;
v_havetoken := '1';
615,27 → 590,25
if v_needtoken = '1' then
v.pend_tick := '0';
end if;
else
if r.allow_fct = '1' and (xmiti.fct_in = '1' or r.pend_fct = '1') then
-- prepare to send FCT
v_token.fct := '1';
v_havetoken := '1';
if v_needtoken = '1' then
v.pend_fct := '0';
v.sent_fct := '1';
end if;
elsif r.allow_fct = '1' and (xmiti.fct_in = '1' or r.pend_fct = '1') then
-- prepare to send FCT
v_token.tick := '0';
v_token.fct := '1';
v_token.flag := '0';
v_havetoken := '1';
if v_needtoken = '1' then
v.pend_fct := '0';
v.sent_fct := '1';
end if;
if r.allow_char = '1' and r.pend_char = '1' then
-- prepare to send N-Char
-- Note: it is possible to send an FCT and an N-Char
-- together by enabling the fctpiggy flag.
v_token.fctpiggy := v_token.fct;
v_token.flag := r.pend_data(8);
v_token.char := r.pend_data(7 downto 0);
v_havetoken := '1';
if v_needtoken = '1' then
v.pend_char := '0';
end if;
elsif r.allow_char = '1' and r.pend_char = '1' then
-- prepare to send N-Char
v_token.tick := '0';
v_token.fct := '0';
v_token.flag := r.pend_data(8);
v_token.char := r.pend_data(7 downto 0);
v_havetoken := '1';
if v_needtoken = '1' then
v.pend_char := '0';
end if;
end if;
 
/spacewire_light/trunk/rtl/vhdl/spwpkg.vhd
232,7 → 232,6
component spwstream is
generic (
sysfreq: real; -- clk freq in Hz
txclkfreq: real := 0.0; -- txclk freq in Hz
rximpl: spw_implementation_type := impl_generic;
rxchunk: integer range 1 to 4 := 1; -- max bits per clk
tximpl: spw_implementation_type := impl_generic;
/spacewire_light/trunk/rtl/vhdl/streamtest.vhd
31,9 → 31,6
-- System clock frequency in Hz.
sysfreq: real;
 
-- txclk frequency in Hz (if tximpl = impl_fast).
txclkfreq: real;
 
-- 2-log of division factor from system clock freq to timecode freq.
tickdiv: integer range 12 to 24 := 20;
 
212,7 → 209,6
spwstream_inst: spwstream
generic map (
sysfreq => sysfreq,
txclkfreq => txclkfreq,
rximpl => rximpl,
rxchunk => rxchunk,
tximpl => tximpl,
/spacewire_light/trunk/syn/spwstream_gr-xc3s1500/spwstream_top.vhd
50,7 → 50,6
spwstream_inst: spwstream
generic map (
sysfreq => 60.0e6,
txclkfreq => 240.0e6,
rximpl => impl_fast,
rxchunk => 4,
tximpl => impl_fast,
/spacewire_light/trunk/syn/spwstream_gr-xc3s1500/Makefile
60,7 → 60,7
$(RM) $(PROJ).twx $(PROJ).twr
$(RM) $(PROJ).pcf $(PROJ)_map.mrp $(PROJ)_map.ncd $(PROJ)_map.ngm
$(RM) $(PROJ).ncd $(PROJ).pad $(PROJ).par $(PROJ).xpi $(PROJ)_pad.csv $(PROJ)_pad.txt
$(RM) $(PROJ).bit $(PROJ).bgn $(PROJ).drc
$(RM) $(PROJ).bit $(PROJ).bgn $(PROJ).drca
$(RM) $(PROJ).ptwx $(PROJ).unroutes *.xrpt $(PROJ)_summary.xml $(PROJ)_usage.xml $(PROJ)_map.map
 
bitfile : $(PROJ).bit
/spacewire_light/trunk/syn/streamtest_digilent-xc3s200/streamtest_top.vhd
1,6 → 1,5
--
-- Test of spwstream on Digilent XC3S200 board.
-- 60 MHz system clock, 200 MHz receive clock and transmit clock.
--
-- LED 0 = link started
-- LED 1 = link connecting
99,7 → 98,6
component streamtest is
generic (
sysfreq: real;
txclkfreq: real;
tickdiv: integer range 12 to 24 := 20;
rximpl: spw_implementation_type := impl_generic;
rxchunk: integer range 1 to 4 := 1;
175,7 → 173,6
streamtest_inst: streamtest
generic map (
sysfreq => 60.0e6,
txclkfreq => 200.0e6,
tickdiv => 22,
rximpl => impl_fast,
rxchunk => 4,
/spacewire_light/trunk/README.txt
30,11 → 30,19
The core is "light" in the sense that it does not provide additional
features such as RMAP, routing etc.
 
See doc/Manual.pdf for more information.
This core would be very suitable for application in lab environments,
to add a SpaceWire interface to a custom FPGA design, and for interfacing
between existing SpaceWire equipment and a computer.
 
Future plans:
The project is currently very much in alpha phase. Most importantly,
there is no proper documentation. I WILL PROVIDE DOCUMENTATION SOON.
 
Short term plan:
* more testing
* documentation
 
Long term plan:
* add AMBA bus interface
* try to run on Virtex
 
 
Contact

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.