Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JUST PROVIDE THE VERILOG SOURCE CODE PLEASE. Consider the sequential circuit implementing serial addition built with two shift registers, a 1 - bit full adder

JUST PROVIDE THE VERILOG SOURCE CODE PLEASE. Consider the sequential circuit implementing serial addition built with two shift registers, a 1-bit full adder and a D flip-flop (Figure 6.5) Design and implement in Verilog a 4-bit version of this circuit. Use the behavioral implementation behavioral_serial_adder.vl and make the following changes/additions:
1. Create a logic diagram of the circuit. Use Figure 6.5 and update it using the structure of the behavioral model (add a 2x1 multiplexer and parallel inputs to the shift registers).
2. Cleate a logic diagram of the shift register with parallel load as implemented in module shiftreg (block level multiplexers and D-flip-flops).
3. Create a state diagram of the serial adder.
4. Implement modules shiftreg and serial_adder at gate-level using gate-level D-flip-flops, full adder, and 2x1 multiplexers.
5. Test the circuit with several inputs (adding positive and negative numbers) and show the output.
6. Write a report, including the logic diagrams, the state diagram, the Verilog source code and the test results. //4-bit adder using shift registers and 1-bit serial adder
// Behavioural model
module adder(x,y,S,Load,Clock);
input [3:0] x,y;
input Load,Clock;
output [3:0] S;
wire [3:0] PO;
shiftreg r1(SI,x,SO1,S,Clock,Load),
r2(1'b0,y,SO2,PO,Clock,Load);
serial_adder sa(SO1,SO2,SI,Clock,Load);
// Uncomment the following line to trace execution
// always @(negedge Clock) $monitor("%b %b",S,PO);
endmodule
// Behavioral shift register with parallel load
// Load=1-> load;
// Load=0-> shift
module shiftreg (SI,PI,SO,PO,Clock,Load);
input Load,Clock;
input SI; // Serial input
input [3:0] PI; // Parallel input
output SO; // Serial output
output [3:0] PO; // Parallel output
reg [3:0] R; // Register
assign SO = R[0];
assign PO = R;
always @(negedge Clock)
if (Load) R = PI; // Parallel load
else begin // Shift right
R = R>>1;
R[3]= SI;
end
endmodule
// Behavioral model of 1-bit serial adder
module serial_adder(x,y,S,Clock,Clear);
input x,y,Clock,Clear;
output S;
reg D; // simulating D flip-flop
wire C1;
assign {C,S}= x+y+D; // dataflow binary adder
assign C1= Clear ?0 : C; // behavioral 2x1 multiplexer
always @(negedge Clock)// load D on negative edge
D = C1;
endmodule
module test;
reg signed [3:0] A,B;
reg Load, Clock;
wire signed [3:0] S;
adder add (A,B,S,Load,Clock);
always #1 Clock = ~Clock; // Generate a clock edge at every time unit
initial begin
A=5; B=2;
Load=1; // Load inputs and clear the flip-flop
Clock=1; // Start Clock
#2 Load=0; // Start serial adder (enable shifing)
#8 $display("%d +%d =%d",A,B,S); // Show sum after 4 negaive edges
$finish; // Stop clock pulses
end
endmoduleHig 6-5 Serial Adder
image text in transcribed

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

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions

Question

INFO - 1 1 1 1 Linux COMPARING AND MANIPULATING TEXT

Answered: 1 week ago

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago