Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog Divider/Multiplier/Adder Integers Question

Status
Not open for further replies.

mtantawy1

Newbie level 3
Joined
Aug 12, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,320
Hi, my code currently looks like this. Is there any way my code can accept non integer numbers (A=3.05). I read that my output has to be a reg type so how can we represent multiplication, division or addition using non integers?

For ex. 3.05 + 1.07 or 1.06*5.01. If the output must be of type reg.


I read online that there are very complicated algorithms to do this but is there anything simpler. This is my test code. I want to add multiplication and addition as well.

Any help will be appreciated!

Thank You


`timescale 1ns/1ps

module test(clk,A,B,Y);
input clk;
input signed [9:0] A;
input signed [6:0] B;
output signed [15:0] Y;
reg signed [15:0] Y;


always @(posedge clk) begin

Y <= A/ B;

end
endmodule


TEST BENCH

`include "test.v"
`timescale 1ns/1ps

module tb_test();

reg clk;
reg [9:0] A;
reg [9:0] B;
wire signed [15:0] Y;
initial begin
clk = 0;
A = 8;
B = 10;
#500 $finish;
end


always begin
#1.6 clk = ~clk;
end

test call(clk, A, B, Y);

endmodule

Thanks again
 

Google around for "verilog fixed point" and you'll find some inspiration...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top