Question

In: Electrical Engineering

Use Verilog to design and implement a function as  c = c+∑b*ai, i is from 1 to...

Use Verilog to design and implement a function as  c = c+∑b*ai, i is from 1 to 8. Here ai is stored in a SRAM with width as 16 and depth as 8 (8 rows of 16‐bit data), and b is stored in a 16‐bit register. c is initialized as 0.

Solutions

Expert Solution

the Verilog code for the following shown:

// Code your design here
module equation(c,clk);
reg [15:0] b=2;// register b
input clk;
output reg [31:0] c=0;
reg [31:0] temp=0;
reg [3:0] i=0;
reg [3:0] j;
reg [15:0] a [8];// RAM
initial// just used for initializng the Sram of A since no input is ataken from ports
begin
for(j=0;j<8;j++)
a[j]=j;
end
always@(posedge clk)
begin

if(i<8)
begin
//a_temp=a[i];
temp=a[i]*b+temp;
i=i+1;
end
else
begin
c=temp+c;
$display("c=%d",c);
i=0;
end
end
endmodule

testbench:

// Code your testbench here
// or browse Examples
module test();
wire [31:0] c;
reg clk;
equation e1(c,clk);
initial
begin
clk=0;
$dumpfile("dump.vcd");
$dumpvars(2);
#100 $finish;
end
initial
forever
#2 clk=~clk;
endmodule

waveform:


Related Solutions

Use C++ write a "Design and implement a class of infix calculators" ,simply write a function...
Use C++ write a "Design and implement a class of infix calculators" ,simply write a function named "evaluateInfix()" that evaluates infix expressions. It should have one string parameter and should return an int result. It should call a separate function named "infixToPostfix()" to convert the infix expression into a postfix expression, and then it should do the work of evaluating the resulting postfix expression. Then write a main() function to thoroughly test the function. Use the pseudocode algorithm that evaluates...
Design and implement a function with two input parameters, A and B. The functions then calculates...
Design and implement a function with two input parameters, A and B. The functions then calculates the result of the floor division of A over B (A//B). You are not allowed to use the floor division operator. Look at here: https://simple.wikipedia.org/wiki/Division_(mathematics) - For instance the function for 20 and 6 will return 3.
1. Q(A,B,C,D) = ABC'+ A'BC+C'D'+AB'+B'C a) Implement the previous function using logic gates. b) implement the...
1. Q(A,B,C,D) = ABC'+ A'BC+C'D'+AB'+B'C a) Implement the previous function using logic gates. b) implement the same function using a 16 input multiplexer (74150) only. (Hint: draw the truth table for Q) 2. Implement the following logic function using 3-to-8 decoder (74138) and any necessary gates. (Hint: Express Q in minterms.    Q=AB'C+A'C'+BC'
Design a Verilog code for 64x64 array multiplier. Use behavioral Verilog description with full adders and/or...
Design a Verilog code for 64x64 array multiplier. Use behavioral Verilog description with full adders and/or half adders. Please include testbench
I need this in C# with pseudocode Exercise #2: Design and implement a programming (name it...
I need this in C# with pseudocode Exercise #2: Design and implement a programming (name it EvenOdd) that uses a while loop to determine and print out all even numbers between 50 and 100 on a single line, separated by commas. Then another while loop in the same program to print out all odd numbers between 50 and 100 on a new line, separated by commas. Document your code and properly label the outputs as shown below. Even numbers between...
A, B:   Design and Implement a C# windows form application to ask the user for 10...
A, B:   Design and Implement a C# windows form application to ask the user for 10 integer numbers, sort them in ascending order and display the sorted list. Use bubble sort technique to sort the array elements and do not use any built-in sort method to sort the array elements.                                                        [02] C:    Test and evaluate your program by inputting variety of values.
A, B:    Design and Implement a C# windows form application to encrypt and decrypt text....
A, B:    Design and Implement a C# windows form application to encrypt and decrypt text. The application use to receive a string and display another encrypted string. The application also decrypt the encrypted string. The approach for encryption/decryption is simple one i.e. to encrypt we will add 1 to each character, so that "hello" would become "ifmmp", and to decrypt we would subtract 1 from each character.    C:   Test and evaluate application by applying different strings.      ...
Use on 4-to-1 MUX to implement the majority function
Use on 4-to-1 MUX to implement the majority function
I need this in C# please. Exercise #2: Design and implement a programming (name it NextMeeting)...
I need this in C# please. Exercise #2: Design and implement a programming (name it NextMeeting) to determine the day of your next meeting from today. The program reads from the user an integer value representing today’s day (assume 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, etc…) and another integer value representing the number of days to the meeting day. The program determines and prints out the meeting day. Format the outputs following the sample...
1.            Determine whether the function f from { a, b, c, d } to {a,...
1.            Determine whether the function f from { a, b, c, d } to {a, b, c, d, e} is injective (one-to-one), surjective (onto) and/or bijective (one-to- one correspondence) : f(a) = a,            f(b) = c,            f(c) = b, f(d) = e a. Is this function injective?              . surjective?              . bijective?              . If your answer is no for any of the above, explain:             b. Is there an inverse for this function?              . c. Is the composition f...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT