Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16613 Discussions

sorting 4 numbers with controller and datapath

Altera_Forum
Honored Contributor II
1,256 Views

hi 

i'm working on a machine that sorts 4 numbers with 4 bits. 

i can't understand why it doesnt work. 

i made it by ussing "bubble sort" technique 

all files here include an image of the machine. 

the machine works well with the second and the third numbers but it doesnt works with the first and the fourth. 

compare2 - the comperator 

contcomp- controller 

top - the main. 

thanks in advance
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
492 Views

an easy way is to address four locations (out of 16) with the numbers serially and write value 1 there then read them back. 

 

e.g. if address sequence (A,B,C,D] is 11, 15,0,1 then 

 

addresses 0,1,11,15 will be set to 1, others 0 

read back from 0 to 15 

min will be first address with 1 and so on
0 Kudos
Reply