Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a verilog code to implement the following function without using > > , < < , + , * , operators: E =

write a verilog code to implement the following function without using >>,<<,+,*,\ operators:
E = A /2^i+ B *2^j
F = E * C
Where:
A, B, C and E are 8-bit unsigned numbers
i and j are 3-bit unsigned numbers.
F is 16-bit unsigned number
Design Specification:
Implement the design using Verilog language. Do not use the following math operations:
-,+,*,/,<<,>> shift/rotate. You need to implement them yourself.
The top design name is mydesign and the port definition is illustrated below. You must
use the below testbench and template in your design.
Use your own choice of multiplier algorithm to implement the multiplier
`timescale 1ns/100ps
module mydesign_tb;
reg [7:0] A;
reg [7:0] B;
reg [7:0] C;
reg [2:0] i, j;
wire [15:0] F;
// Mydesign one round in hardware
mydesign mydesign (
.A (A),
.B (B),
.C (C),
.i (i),
.j (j),
.F (F)
);
initial begin
$monitor ("(values are in HEX) A=%h B=%h C=%h i=%h j=%h F=%h", A, B, C,
i, j, F);
A=8'h06; B=8'h06; C=8'h06 ; i=3'h1; j=3'h1;
#10;
A=8'h01; B=8'h01; C=8'h01 ; i=3'h1; j=3'h1;
#10;
A=8'hFF; B=8'hFF; C=8'hFF ; i=3'h7; j=3'h7;
#10;
A=8'hFF; B=8'hFF; C=8'hFF ; i=3'h0; j=3'h0;
#10;
$stop;
end
endmodule
write a verilog code to implement the following function without using >>,<<,*,/:
E = A /2^i+ B^j
F = E *C
Where:
A, B, C and E are 8-bit unsigned numbers
i and j are 3-bit unsigned numbers.
F is 16-bit unsigned number
Design Specification:
Implement the design using Verilog language. Do not use the following math operations:
-,+,,/, shift/rotate. You need to implement them yourself.
The top design name is mydesign and the port definition is illustrated below. You must
use the below testbench and template in your design.
Use your own choice of multiplier algorithm to implement the multiplier
timescale 1ns/100ps
module mydesign_tb;
reg [7:0] A;
reg [7:0] B;
reg [7:0] C;
reg [2:0] i, j;
wire [15:0] F;
// Mydesign one round in hardware
mydesign mydesign (
.A (A),
.B (B),
.C (C),
.i (i),
.j (j),
.F (F)
);
initial begin
$monitor ("(values are in HEX) A=%h B=%h C=%h i=%h j=%h F=%h", A, B, C,
i, j, F);
A=8'h06; B=8'h06; C=8'h06 ; i=3'h1; j=3'h1;
#10;
A=8'h01; B=8'h01; C=8'h01 ; i=3'h1; j=3'h1;
#10;
A=8'hFF; B=8'hFF; C=8'hFF ; i=3'h7; j=3'h7;
#10;
A=8'hFF; B=8'hFF; C=8'hFF ; i=3'h0; j=3'h0;
#10;
$stop;
end
endmodule

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions