Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Bubble sortin in System Verilog.

Status
Not open for further replies.

Johnny_freeman78

Newbie level 1
Joined
Jan 31, 2016
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
21
I need some help getting started with writing the following two sort .sv file. Can someone help?

(a) sortEight.sv Write a module sortEight, which accepts eight signed values and returns eight signed values sorted from least to greatest. You should submit one file for this problem called “sortEight.sv”. Any additional modules should be included in the file. You should not change the interface provided below. (Hint: Start by constructing a sortTwo module and then drawing a block diagram for a parallel bubble sort).


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
module sortEight ( 
input logic signed [ 1 5 : 0 ] A[ 7 : 0 ] , 
output logic signed [ 1 5 : 0 ] B[ 7 : 0 ] ) ; 
 
// B[0] should contain the least , 
// and B[7] should contain the greatest
// Your code here 
 
endmodule




(b) firstOne.sv Write a module firstOne.sv, which accepts a 16 bit string and returns a 16 bits string that is one-hot. The output “B” should indicate the position of the “left- most-one” in the input. For example, 11111011 → 10000000 ; 00001011 → 00001000. Note that we consider the MSB to be the left most position. Any additional modules should be included in the file. You should not change the interface provided below. (Hint: Start by thinking about our ripple carry adder, which evaluates an individual bit slice. Each slice in this case needs to know if anyone to the left has been one. Think about building a local version. Alternatively, you might be interested in using don’t care conditions in a priority case statement).


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
module firstOne ( 
 
input logic signed A[15:0] , 
output logic signed B[ 1 5 : 0 ] ) ; 
// B should be one hot and 
// indicate a 1 ’b1 in A eg . B ˜ˆ A == B
// Your code here 
 
endmodule

 
Last edited by a moderator:

I thought the hints are supposed to help get you started?
What exactly do you want us to do? have you even bothered to try to do this yourself, as you're clearly supposed to do?
 

Hmmm, must be some new .sv syntax that I'm not aware of...

Code:
input logic signed [ 1 5 : 0 ] A[ 7 : 0 ] , 
                      ^ - 1 space 5?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top