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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [wbscope.v] - Diff between revs 25 and 30

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 25 Rev 30
Line 1... Line 1...
///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Filename:    wbscope.v
// Filename:    wbscope.v
//
//
// Project:     FPGA Library of Routines
// Project:     FPGA Library of Routines
//
//
Line 56... Line 56...
//      dw_     A wire/net, controlled by the data clock
//      dw_     A wire/net, controlled by the data clock
//
//
// Creator:     Dan Gisselquist, Ph.D.
// Creator:     Dan Gisselquist, Ph.D.
//              Gisselquist Technology, LLC
//              Gisselquist Technology, LLC
//
//
///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
//
// Copyright (C) 2015, Gisselquist Technology, LLC
// Copyright (C) 2015, Gisselquist Technology, LLC
//
//
// This program is free software (firmware): you can redistribute it and/or
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of  the GNU General Public License as published
// modify it under the terms of  the GNU General Public License as published
Line 79... Line 79...
//
//
// License:     GPL, v3, as defined and found on www.gnu.org,
// License:     GPL, v3, as defined and found on www.gnu.org,
//              http://www.gnu.org/licenses/gpl.html
//              http://www.gnu.org/licenses/gpl.html
//
//
//
//
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
 
//
 
//
module wbscope(i_clk, i_ce, i_trigger, i_data,
module wbscope(i_clk, i_ce, i_trigger, i_data,
        i_wb_clk, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
        i_wb_clk, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
        o_wb_ack, o_wb_stall, o_wb_data,
        o_wb_ack, o_wb_stall, o_wb_data,
        o_interrupt);
        o_interrupt);
        parameter       LGMEM = 5'd10, BUSW = 32, SYNCHRONOUS=1;
        parameter       LGMEM = 5'd10, BUSW = 32, SYNCHRONOUS=1,
 
                        DEFAULT_HOLDOFF = ((1<<(LGMEM-1))-4);
        // The input signals that we wish to record
        // The input signals that we wish to record
        input                           i_clk, i_ce, i_trigger;
        input                           i_clk, i_ce, i_trigger;
        input           [(BUSW-1):0]     i_data;
        input           [(BUSW-1):0]     i_data;
        // The WISHBONE bus for reading and configuring this scope
        // The WISHBONE bus for reading and configuring this scope
        input                           i_wb_clk, i_wb_cyc, i_wb_stb, i_wb_we;
        input                           i_wb_clk, i_wb_cyc, i_wb_stb, i_wb_we;
Line 107... Line 110...
        // Our status/config register
        // Our status/config register
        wire            bw_reset_request, bw_manual_trigger,
        wire            bw_reset_request, bw_manual_trigger,
                        bw_disable_trigger, bw_reset_complete;
                        bw_disable_trigger, bw_reset_complete;
        reg     [22:0]   br_config;
        reg     [22:0]   br_config;
        wire    [19:0]   bw_holdoff;
        wire    [19:0]   bw_holdoff;
        initial br_config = ((1<<(LGMEM-1))-4);
        initial br_config = DEFAULT_HOLDOFF;
        always @(posedge i_wb_clk)
        always @(posedge i_wb_clk)
                if ((i_wb_cyc)&&(i_wb_stb)&&(~i_wb_addr))
                if ((i_wb_cyc)&&(i_wb_stb)&&(~i_wb_addr))
                begin
                begin
                        if (i_wb_we)
                        if (i_wb_we)
                                br_config <= { i_wb_data[31],
                                br_config <= { i_wb_data[31],
Line 133... Line 136...
                assign  dw_manual_trigger = bw_manual_trigger;
                assign  dw_manual_trigger = bw_manual_trigger;
                assign  dw_disable_trigger = bw_disable_trigger;
                assign  dw_disable_trigger = bw_disable_trigger;
                assign  bw_reset_complete = bw_reset_request;
                assign  bw_reset_complete = bw_reset_request;
        end else begin
        end else begin
                reg             r_reset_complete;
                reg             r_reset_complete;
                reg     [2:0]    r_iflags, q_iflags;
                (* ASYNC_REG = "TRUE" *) reg    [2:0]    q_iflags;
 
                reg     [2:0]    r_iflags;
 
 
                // Resets are synchronous to the bus clock, not the data clock
                // Resets are synchronous to the bus clock, not the data clock
                // so do a clock transfer here
                // so do a clock transfer here
                initial q_iflags = 3'b000;
                initial q_iflags = 3'b000;
                initial r_reset_complete = 1'b0;
                initial r_reset_complete = 1'b0;
Line 150... Line 154...
 
 
                assign  dw_reset = r_iflags[2];
                assign  dw_reset = r_iflags[2];
                assign  dw_manual_trigger = r_iflags[1];
                assign  dw_manual_trigger = r_iflags[1];
                assign  dw_disable_trigger = r_iflags[0];
                assign  dw_disable_trigger = r_iflags[0];
 
 
                reg     q_reset_complete, qq_reset_complete;
                (* ASYNC_REG = "TRUE" *) reg    q_reset_complete;
 
                reg     qq_reset_complete;
                // Pass an acknowledgement back from the data clock to the bus
                // Pass an acknowledgement back from the data clock to the bus
                // clock that the reset has been accomplished
                // clock that the reset has been accomplished
                initial q_reset_complete = 1'b0;
                initial q_reset_complete = 1'b0;
                initial qq_reset_complete = 1'b0;
                initial qq_reset_complete = 1'b0;
                always @(posedge i_wb_clk)
                always @(posedge i_wb_clk)
Line 188... Line 193...
        //
        //
        // Determine when memory is full and capture is complete
        // Determine when memory is full and capture is complete
        //
        //
        // Writes take place on the data clock
        // Writes take place on the data clock
        reg             dr_stopped;
        reg             dr_stopped;
        reg     [19:0]   counter;        // This is unsigned
        (* ASYNC_REG="TRUE" *) reg      [19:0]   counter;// This is unsigned
        initial dr_stopped = 1'b0;
        initial dr_stopped = 1'b0;
        initial counter = 20'h0000;
        initial counter = 20'h0000;
        always @(posedge i_clk)
        always @(posedge i_clk)
                if (dw_reset)
                if (dw_reset)
                begin
                begin
Line 250... Line 255...
                // These aren't a problem, since none of these are strobe
                // These aren't a problem, since none of these are strobe
                // signals.  They goes from low to high, and then stays high
                // signals.  They goes from low to high, and then stays high
                // for many clocks.  Swapping is thus easy--two flip flops to
                // for many clocks.  Swapping is thus easy--two flip flops to
                // protect against meta-stability and we're done.
                // protect against meta-stability and we're done.
                //
                //
                reg     [2:0]    q_oflags, r_oflags;
                (* ASYNC_REG = "TRUE" *) reg    [2:0]    q_oflags;
 
                reg     [2:0]    r_oflags;
                initial q_oflags = 3'h0;
                initial q_oflags = 3'h0;
                initial r_oflags = 3'h0;
                initial r_oflags = 3'h0;
                always @(posedge i_wb_clk)
                always @(posedge i_wb_clk)
                        if (bw_reset_request)
                        if (bw_reset_request)
                        begin
                        begin

powered by: WebSVN 2.1.0

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