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

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'
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.      ...
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# 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...
Use on 4-to-1 MUX to implement the majority function
Use on 4-to-1 MUX to implement the majority function
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE...
Given a Boolean function: f(a,b,c,d) = m(1,6,7,10,12)+dc(3,4,9,15). i) Design a circuit for implementing f(a,b,c,d) with ONE 4-to-1 MUX and other basic logic gates. USE a and b as select inputs. ii) Draw the circuit. iii) Write the VHDL code for a 4-to-1 MUX, named “mux_4to1”, with input: a, b, c, d, s0, s1; and output: z. iv) Write the complete VHDL code for the above circuit in part (iii), named “Boolean_MUX”.
In C ++, Design and implement a program that reads from the user four integer values...
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:    95, 80, 100, 70 Highest grade: 100 Lowest grade:   70 Average grade: 86.25
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...
- Design and implement a function with no input parameters. The function keeps receiving a number...
- Design and implement a function with no input parameters. The function keeps receiving a number from input (user) and adds the numbers together. The application keeps doing it until the user enter 0. Then the application will stop and print the total sum and average of the numbers the user had entered.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT