📄 umultiply_beh.v
字号:
/*********************************************************/
// MODULE: unsigned integer multiplier
//
// FILE NAME: umultiply_beh.v
// VERSION: 1.0
// DATE: January 1, 1999
// AUTHOR: Bob Zeidman, Zeidman Consulting
//
// CODE TYPE: Behavioral Level
//
// DESCRIPTION: This module defines a multiplier of
// unsigned integers.
//
/*********************************************************/
// DEFINES
`define DEL 1 // Clock-to-output delay. Zero
// time delays can be confusing
// and sometimes cause problems.
`define OP_BITS 4 // Number of bits in each operand
// TOP MODULE
module UnsignedMultiply(
clk,
reset,
a,
b,
multiply_en,
product,
valid);
// INPUTS
input clk; // Clock
input reset; // Reset input
input [`OP_BITS-1:0] a; // Multiplicand
input [`OP_BITS-1:0] b; // Multiplier
input multiply_en; // Multiply enable input
// OUTPUTS
output [2*`OP_BITS-1:0] product; // Product
output valid; // Is output valid yet?
// INOUTS
// SIGNAL DECLARATIONS
wire clk;
wire reset;
wire [`OP_BITS-1:0] a;
wire [`OP_BITS-1:0] b;
wire multiply_en;
reg [2*`OP_BITS-1:0] product;
reg valid;
// PARAMETERS
// ASSIGN STATEMENTS
// MAIN CODE
// Look at the reset input
always @(reset) begin
if (reset)
#`DEL assign valid = 1'b0;
else
deassign valid;
end
// Look at the rising edge of the clock
always @(posedge clk) begin
if (multiply_en) begin
product <= #`DEL a*b;
valid <= #`DEL 1'b1;
end
end
endmodule // UnsignedMultiply
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -