Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

following i have the implementations for each one : the program for the sorter i s : module sorter input logic [ 7 : 0

following i have the implementations for each one : the program for the sorter is : module sorter
input logic [7:0] A,
input logic [7:0] B,
output logic [7:0] max,
output logic [7:0] min
);
always_comb begin
if (A > B) begin
max = A;
min = B;
end else begin
max = B;
min = A;
end
end
endmodule
the program for odd-even merge sort is :
module even_odd_merge_sorter(
input logic [7:0] A,
input logic [7:0] B,
input logic [7:0] C,
input logic [7:0] D,
output logic [7:0] max,
output logic [7:0] second_max,
output logic [7:0] second_min,
output logic [7:0] min
);
logic [7:0] sorter_1_max;
logic [7:0] sorter_1_min;
logic [7:0] sorter_2_max;
logic [7:0] sorter_2_min;
logic [7:0] sorter_3_min;
logic [7:0] sorter_4_max;
sorter sorter_1(A, B, sorter_1_max, sorter_1_min);
sorter sorter_2(C, D, sorter_2_max, sorter_2_min);
sorter sorter_3(sorter_1_max, sorter_2_max, max, sorter_3_min);
sorter sorter_4(sorter_1_min, sorter_2_min, sorter_4_max, min);
sorter sorter_5(sorter_3_min, sorter_4_max, second_max, second_min);
endmodule
the program for the circuit 3is : module even_odd_merge_sorter_wrapper(
input logic clk,
input logic rst,
input logic [7:0] A,
input logic [7:0] B,
input logic [7:0] C,
input logic [7:0] D,
output logic [7:0] max,
output logic [7:0] second_max,
output logic [7:0] second_min,
output logic [7:0] min
);
logic [7:0] regA, regB, regC, regD;
logic [7:0] reg_max, reg_second_max, reg_second_min, reg_min;
logic [7:0] sorter_1_max;
logic [7:0] sorter_1_min;
logic [7:0] sorter_2_max;
logic [7:0] sorter_2_min;
logic [7:0] sorter_3_min;
logic [7:0] sorter_4_max;
// Register Input
always_ff@(posedge clk) begin
if (rst) begin
regA =8'b0;
regB =8'b0;
regC =8'b0;
regD =8'b0;
end else begin
regA = A;
regB = B;
regC = C;
regD = D;
end
end
// intsantiate even_odd_merge_sorter circuit
even_odd_merge_sorter sorter_0(regA, regB, regC, regD, reg_max, reg_second_max, reg_second_min, reg_min);
// Register Output
always_ff@(posedge clk) begin
if (rst) begin
max =8'b0;
second_max =8'b0;
second_min =8'b0;
min =8'b0;
end else begin
max = reg_max;
second_max = reg_second_max;
second_min = reg_second_min;
min = reg_min;
end
end
endmodule
the program for techbench is :
so according to all above programs i want a program for the circuit 4 for vivado. thank you very much module even_odd_merge_sorter_tb;
parameter MEM_SIZE =30;
logic clk, rst;
logic [7:0] A;
logic [7:0] B;
logic [7:0] C;
logic [7:0] D;
logic [7:0] max;
logic [7:0] second_max;
logic [7:0] second_min;
logic [7:0] min;
logic [63:0] test_memory[0:MEM_SIZE-1];
integer i;
always begin
clk =1;
#5ns;
clk =0;
#5ns;
end
even_odd_merge_sorter_wrapper sorter_0(clk, rst, A, B, C, D, max, second_max, second_min, min);
initial begin
$monitor($time, " max=%h, second_max=%h, second_min=%h, min=%h", max, second_max, second_min, min);
$display("Loading test vectors");
$readmemh("test.tv", test_memory);
rst =1;
repeat(2) @(posedge clk);
rst =0;
for (i=0; i
so according to all above programs i want a program for the circuit 4 for vivado. thank you very much
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_2

Step: 3

blur-text-image_3

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

Students also viewed these Databases questions

Question

=+ to observe the singularity of the strain energy at r = 0;

Answered: 1 week ago