Line 1... |
Line 1... |
///////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: wbscopc.v
|
// Filename: wbscopc.v
|
//
|
//
|
// Project: FPGA Library of Routines
|
// Project: WBScope, a wishbone hosted scope
|
//
|
//
|
// Purpose: This scope is identical in function to the wishbone scope
|
// Purpose: This scope is identical in function to the wishbone scope
|
// found in wbscope, save that the output is compressed and that (as a
|
// found in wbscope, save that the output is compressed and that (as a
|
// result) it can only handle recording 31 bits at a time. This allows
|
// result) it can only handle recording 31 bits at a time. This allows
|
// the top bit to indicate an 'address difference'. Okay, there's
|
// the top bit to indicate an 'address difference'. Okay, there's
|
Line 59... |
Line 59... |
// are valuable, but could never be done if the scope wasn't compressed.
|
// are valuable, but could never be done if the scope wasn't compressed.
|
//
|
//
|
// 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,2017, 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
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// your option) any later version.
|
// your option) any later version.
|
Line 74... |
Line 74... |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// You should have received a copy of the GNU General Public License along
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
// target there if the PDF file isn't present.) If not, see
|
// target there if the PDF file isn't present.) If not, see
|
// <http://www.gnu.org/licenses/> for a copy.
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// 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 wbscopc(i_clk, i_ce, i_trigger, i_data,
|
module wbscopc(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, NELM=32, BUSW = 32, SYNCHRONOUS=1;
|
parameter LGMEM = 5'd10, NELM=31, BUSW = 32, SYNCHRONOUS=1;
|
// 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 [(NELM-1):0] i_data;
|
input [(NELM-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 111... |
Line 111... |
// wbscope program, and suffer a lack of several features
|
// wbscope program, and suffer a lack of several features
|
|
|
// When is the full scope reset? Capture that reset bit from any
|
// When is the full scope reset? Capture that reset bit from any
|
// write.
|
// write.
|
wire lcl_reset;
|
wire lcl_reset;
|
assign lcl_reset = (i_wb_cyc)&&(i_wb_stb)&&(~i_wb_addr)&&(i_wb_we)
|
assign lcl_reset = (i_wb_stb)&&(~i_wb_addr)&&(i_wb_we)
|
&&(~i_wb_data[31]);
|
&&(~i_wb_data[31]);
|
|
|
// A big part of this scope is the 'address' of any particular
|
// A big part of this scope is the 'address' of any particular
|
// data value. As of this current version, the 'address' changed
|
// data value. As of this current version, the 'address' changed
|
// in definition from an absolute time (which had all kinds of
|
// in definition from an absolute time (which had all kinds of
|
Line 136... |
Line 136... |
else if (&ck_addr)
|
else if (&ck_addr)
|
; // Saturated (non-overflowing) address diff
|
; // Saturated (non-overflowing) address diff
|
else
|
else
|
ck_addr <= ck_addr + 1;
|
ck_addr <= ck_addr + 1;
|
|
|
|
wire [(BUSW-2):0] w_data;
|
|
generate
|
|
if (NELM == BUSW-1)
|
|
assign w_data = i_data;
|
|
else
|
|
assign w_data = { {(BUSW-NELM-1){1'b0}}, i_data };
|
|
endgenerate
|
|
|
//
|
//
|
// To do our compression, we keep track of two registers: the most
|
// To do our compression, we keep track of two registers: the most
|
// recent data to the device (imm_ prefix) and the data from one
|
// recent data to the device (imm_ prefix) and the data from one
|
// clock ago. This allows us to suppress writes to the scope which
|
// clock ago. This allows us to suppress writes to the scope which
|
// would otherwise be two address writes in a row.
|
// would otherwise be two address writes in a row.
|
Line 157... |
Line 165... |
lst_val <= 31'h0;
|
lst_val <= 31'h0;
|
lst_adr <= 1'b1;
|
lst_adr <= 1'b1;
|
lst_dat <= 0;
|
lst_dat <= 0;
|
end else if ((i_ce)&&(i_data != lst_dat))
|
end else if ((i_ce)&&(i_data != lst_dat))
|
begin
|
begin
|
imm_val <= { {(BUSW-1-NELM){1'b0}}, i_data };
|
imm_val <= w_data;
|
imm_adr <= 1'b0;
|
imm_adr <= 1'b0;
|
lst_val <= imm_val;
|
lst_val <= imm_val;
|
lst_adr <= imm_adr;
|
lst_adr <= imm_adr;
|
lst_dat <= i_data;
|
lst_dat <= i_data;
|
end else begin
|
end else begin
|