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

Subversion Repositories thor

[/] [thor/] [trunk/] [rtl/] [verilog/] [Thor_multiplier.v] - Diff between revs 3 and 13

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

Rev 3 Rev 13
Line 1... Line 1...
// ============================================================================
// ============================================================================
//        __
//        __
//   \\__/ o\    (C) 2013  Robert Finch, Stratford
//   \\__/ o\    (C) 2013,2015  Robert Finch, Stratford
//    \  __ /    All rights reserved.
//    \  __ /    All rights reserved.
//     \/_//     robfinch<remove>@finitron.ca
//     \/_//     robfinch<remove>@finitron.ca
//       ||
//       ||
//
//
// This source file is free software: you can redistribute it and/or modify 
// This source file is free software: you can redistribute it and/or modify 
Line 23... Line 23...
// Thor_multiplier.v
// Thor_multiplier.v
//  - 64 bit multiplier
//  - 64 bit multiplier
//
//
// ============================================================================
// ============================================================================
//
//
module Thor_multiplier(rst, clk, ld, sgn, isMuli, a, b, imm, o, done);
module Thor_multiplier(rst, clk, ld, abort, sgn, isMuli, a, b, imm, o, done, idle);
parameter WID=64;
parameter WID=64;
parameter SGNADJO=3'd2;
parameter SGNADJO=3'd2;
parameter MULT=3'd3;
parameter MULT=3'd3;
parameter IDLE=3'd4;
parameter IDLE=3'd4;
parameter DONE=3'd5;
parameter DONE=3'd5;
input clk;
input clk;
input rst;
input rst;
input ld;
input ld;
 
input abort;
input sgn;
input sgn;
input isMuli;
input isMuli;
input [WID-1:0] a;
input [WID-1:0] a;
input [WID-1:0] b;
input [WID-1:0] b;
input [WID-1:0] imm;
input [WID-1:0] imm;
output [WID*2-1:0] o;
output [WID*2-1:0] o;
reg [WID*2-1:0] o;
reg [WID*2-1:0] o;
output done;
output done;
 
output idle;
 
 
reg [WID-1:0] aa,bb;
reg [WID-1:0] aa,bb;
reg so;
reg so;
reg [2:0] state;
reg [2:0] state;
reg [7:0] cnt;
reg [7:0] cnt;
wire cnt_done = cnt==8'd0;
wire cnt_done = cnt==8'd0;
assign done = state==DONE;
assign done = state==DONE;
 
assign idle = state==IDLE;
reg ce1;
reg ce1;
reg [WID*2-1:0] prod;
reg [WID*2-1:0] prod;
//wire [64:0] p1 = aa[0] ? prod[127:64] + b : prod[127:64];
//wire [64:0] p1 = aa[0] ? prod[127:64] + b : prod[127:64];
//wire [65:0] p2 = aa[1] ? p1 + {b,1'b0} : p1;
//wire [65:0] p2 = aa[1] ? p1 + {b,1'b0} : p1;
wire [WID+WID/4-1:0] p1 = bb * aa[WID/4-1:0] + prod[WID*2-1:WID];
wire [WID+WID/4-1:0] p1 = bb * aa[WID/4-1:0] + prod[WID*2-1:WID];
Line 68... Line 71...
        o <= {WID*2{1'b0}};
        o <= {WID*2{1'b0}};
        state <= IDLE;
        state <= IDLE;
end
end
else
else
begin
begin
if (!cnt_done)
if (abort)
 
    cnt <= 8'd00;
 
else if (!cnt_done)
        cnt <= cnt - 8'd1;
        cnt <= cnt - 8'd1;
 
 
case(state)
case(state)
IDLE:
IDLE:
        if (ld) begin
        if (ld) begin

powered by: WebSVN 2.1.0

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