HierarchyFilesModulesSignalsTasksFunctionsHelp
// dkcm_controller.v
// Constant Coefficient Multiplier (KCM)
// $Id$
// Larry Doolittle, LBNL

// llc-suite Copyright (c) 2004, The Regents of the University of
// California, through Lawrence Berkeley National Laboratory (subject
// to receipt of any required approvals from the U.S. Dept. of Energy).
// All rights reserved.

// Your use of this software is pursuant to a "BSD-style" open
// source license agreement, the text of which is in license.txt
// (md5sum a1e0e81c78f6eba050b0e96996f49fd5) that should accompany
// this file.  If the license agreement is not there, or if you
// have questions about the license, please contact Berkeley Lab's
// Technology Transfer Department at TTD@lbl.gov referring to
// "llc-suite (LBNL Ref CR-1988)"

// See dkcm_bussed for info

`timescale 1ns / 1ns

[Up: llrf_interim dkcm_controller]
module dkcm_controllerIndex(
	input  host_clk,           // interconnect
	input  [13:0] host_addr,   // interconnect
	input  host_we,            // interconnect
	input  select,             // select  KCM_BASE
	input  [15:0] host_data,   // interconnect
	output dkcm_busy,          // interconnect
	output [21:0] dkcm_bus     // interconnect
);

reg [11:0] konstant;
reg [15:0] acc;
reg [1:0] sel;
reg [4:0] state;
`ifdef SIMULATE
initial state = 0;
`endif
reg [2:0] addr;
reg load;

wire local_host_we = host_we & select;

assign dkcm_busy = state != 5'b00000;
always @(posedge host_clk) begin
	load <= local_host_we;
	if (local_host_we) begin
		konstant <= host_data[15:4];
		addr <= host_addr[2:0];
	end
	if (dkcm_busy | load) state <= (state == 5'b11000)?0:(state+1'b1);
	sel <= (dkcm_busy | load) ? ( state[4:3] + 1'b1 ) : 0;
	acc <= ((state==8) ? {konstant, 4'b0000} :
		( (state==0) ? 0 : acc ) ) - {{4{konstant[11]}},konstant};
end
always @(negedge host_clk) if (dkcm_busy)
	$display("reloading: %d %x %d", state, acc, sel);

wire corrupt = load | dkcm_busy;
assign dkcm_bus = {corrupt, acc, addr, sel};

endmodule

HierarchyFilesModulesSignalsTasksFunctionsHelp

This page: Maintained by: ldoolitt@recycle.lbl.gov
Created:Wed May 19 11:23:11 2004
From: ../source/dkcm_controller.v

Verilog converted to html by v2html 7.30 (written by Costas Calamvokis).Help