Dealing with priority encoder when output is described by 3 seperate signals
I dont know how to deal with the third part of the priority encoder
where if more than one 1
appear in the inputs
the output will be the number
of the most significant
1
. At first i thought maybe making the for loop
so the i decreases
but i couldnt really apply it. And i am pretty sure there is an easier way than creating all the 4 bit
combinations for the VD
.
The truth table:
http://prntscr.com/limnd8
and examples of how it should work :
D3=0, D2=0, D1=0, D0=0 --> Υ1=0, Υ0=0, Zeros =1
D3=1, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=1, Zeros =0
D3=0, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=0, Zeros =0
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
VD = 4'b0000;
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
VD = 4'b1111;
for (i=3; i>=0; i=i-1)
begin
if ((2**i) == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
end
//////////////////////////
else if(VD[ == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
//////////////////////
end
end
end
endmodule
I modified it very little bit but i cant control the else if statement correctly
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
//reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
for (i=3; i>=0; i=i-1)
begin
if ({D3,D2,D1,D0} == (2**i))
begin
{Y1,Y0} = i;
Z = 0;
end
else if({D3,D2,D1,D0}>2**i)
begin
{Y1,Y0} = i;
Z = 0;
end
end
end
endmodule
Ok, I reverted my for
back so i
increases and it works i think . I will leave it a little more if someone want to see anything or he/she can make the code make less space but leaving the signals as they are(or if they add one reg like the commented one kinda)
verilog
add a comment |
I dont know how to deal with the third part of the priority encoder
where if more than one 1
appear in the inputs
the output will be the number
of the most significant
1
. At first i thought maybe making the for loop
so the i decreases
but i couldnt really apply it. And i am pretty sure there is an easier way than creating all the 4 bit
combinations for the VD
.
The truth table:
http://prntscr.com/limnd8
and examples of how it should work :
D3=0, D2=0, D1=0, D0=0 --> Υ1=0, Υ0=0, Zeros =1
D3=1, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=1, Zeros =0
D3=0, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=0, Zeros =0
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
VD = 4'b0000;
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
VD = 4'b1111;
for (i=3; i>=0; i=i-1)
begin
if ((2**i) == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
end
//////////////////////////
else if(VD[ == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
//////////////////////
end
end
end
endmodule
I modified it very little bit but i cant control the else if statement correctly
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
//reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
for (i=3; i>=0; i=i-1)
begin
if ({D3,D2,D1,D0} == (2**i))
begin
{Y1,Y0} = i;
Z = 0;
end
else if({D3,D2,D1,D0}>2**i)
begin
{Y1,Y0} = i;
Z = 0;
end
end
end
endmodule
Ok, I reverted my for
back so i
increases and it works i think . I will leave it a little more if someone want to see anything or he/she can make the code make less space but leaving the signals as they are(or if they add one reg like the commented one kinda)
verilog
start with using the bitwiseor
instead of the comparison:if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.
– Serge
Nov 15 '18 at 11:58
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to usecasez
instead.
– Serge
Nov 15 '18 at 13:27
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34
add a comment |
I dont know how to deal with the third part of the priority encoder
where if more than one 1
appear in the inputs
the output will be the number
of the most significant
1
. At first i thought maybe making the for loop
so the i decreases
but i couldnt really apply it. And i am pretty sure there is an easier way than creating all the 4 bit
combinations for the VD
.
The truth table:
http://prntscr.com/limnd8
and examples of how it should work :
D3=0, D2=0, D1=0, D0=0 --> Υ1=0, Υ0=0, Zeros =1
D3=1, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=1, Zeros =0
D3=0, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=0, Zeros =0
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
VD = 4'b0000;
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
VD = 4'b1111;
for (i=3; i>=0; i=i-1)
begin
if ((2**i) == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
end
//////////////////////////
else if(VD[ == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
//////////////////////
end
end
end
endmodule
I modified it very little bit but i cant control the else if statement correctly
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
//reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
for (i=3; i>=0; i=i-1)
begin
if ({D3,D2,D1,D0} == (2**i))
begin
{Y1,Y0} = i;
Z = 0;
end
else if({D3,D2,D1,D0}>2**i)
begin
{Y1,Y0} = i;
Z = 0;
end
end
end
endmodule
Ok, I reverted my for
back so i
increases and it works i think . I will leave it a little more if someone want to see anything or he/she can make the code make less space but leaving the signals as they are(or if they add one reg like the commented one kinda)
verilog
I dont know how to deal with the third part of the priority encoder
where if more than one 1
appear in the inputs
the output will be the number
of the most significant
1
. At first i thought maybe making the for loop
so the i decreases
but i couldnt really apply it. And i am pretty sure there is an easier way than creating all the 4 bit
combinations for the VD
.
The truth table:
http://prntscr.com/limnd8
and examples of how it should work :
D3=0, D2=0, D1=0, D0=0 --> Υ1=0, Υ0=0, Zeros =1
D3=1, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=1, Zeros =0
D3=0, D2=1, D1=0, D0=1 --> Υ1=1, Υ0=0, Zeros =0
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
VD = 4'b0000;
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
VD = 4'b1111;
for (i=3; i>=0; i=i-1)
begin
if ((2**i) == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
end
//////////////////////////
else if(VD[ == {D3,D2,D1,D0})
begin
{Y1,Y0} = i;
Z = 0;
//////////////////////
end
end
end
endmodule
I modified it very little bit but i cant control the else if statement correctly
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
//reg [3:0] VD;
integer i;
always @ (D0,D1,D2,D3)
begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
for (i=3; i>=0; i=i-1)
begin
if ({D3,D2,D1,D0} == (2**i))
begin
{Y1,Y0} = i;
Z = 0;
end
else if({D3,D2,D1,D0}>2**i)
begin
{Y1,Y0} = i;
Z = 0;
end
end
end
endmodule
Ok, I reverted my for
back so i
increases and it works i think . I will leave it a little more if someone want to see anything or he/she can make the code make less space but leaving the signals as they are(or if they add one reg like the commented one kinda)
verilog
verilog
edited Nov 15 '18 at 14:54
lowspacetop
asked Nov 15 '18 at 9:44
lowspacetoplowspacetop
376
376
start with using the bitwiseor
instead of the comparison:if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.
– Serge
Nov 15 '18 at 11:58
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to usecasez
instead.
– Serge
Nov 15 '18 at 13:27
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34
add a comment |
start with using the bitwiseor
instead of the comparison:if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.
– Serge
Nov 15 '18 at 11:58
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to usecasez
instead.
– Serge
Nov 15 '18 at 13:27
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34
start with using the bitwise
or
instead of the comparison: if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.– Serge
Nov 15 '18 at 11:58
start with using the bitwise
or
instead of the comparison: if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.– Serge
Nov 15 '18 at 11:58
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to use
casez
instead.– Serge
Nov 15 '18 at 13:27
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to use
casez
instead.– Serge
Nov 15 '18 at 13:27
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34
add a comment |
1 Answer
1
active
oldest
votes
Here is a variant based on your code which works. The idea is that you check using the first '1' in the Ds and stop checking after it. To check them you can use bitwise &
.
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
integer i;
reg flag;
always @* begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
else begin
flag = 0;
for (i=3; i>=0; i=i-1) begin
if (flag == 0 && ({D3,D2,D1,D0} & (4'b0001 << i)) != 0) begin
flag = 1;
{Y1, Y0} = i;
Z = 1'b0;
end
end
end
end
endmodule
The other version is much simpler and more readable in your case:
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
always @* begin
casez({D3,D2,D1,D0})
4'b0000: {Y1,Y0,Z} = 3'b001;
4'b0001: {Y1,Y0,Z} = 3'b000;
4'b001?: {Y1,Y0,Z} = 3'b010;
4'b01??: {Y1,Y0,Z} = 3'b100;
4'b1???: {Y1,Y0,Z} = 3'b110;
endcase
end
endmodule
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316518%2fdealing-with-priority-encoder-when-output-is-described-by-3-seperate-signals%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a variant based on your code which works. The idea is that you check using the first '1' in the Ds and stop checking after it. To check them you can use bitwise &
.
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
integer i;
reg flag;
always @* begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
else begin
flag = 0;
for (i=3; i>=0; i=i-1) begin
if (flag == 0 && ({D3,D2,D1,D0} & (4'b0001 << i)) != 0) begin
flag = 1;
{Y1, Y0} = i;
Z = 1'b0;
end
end
end
end
endmodule
The other version is much simpler and more readable in your case:
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
always @* begin
casez({D3,D2,D1,D0})
4'b0000: {Y1,Y0,Z} = 3'b001;
4'b0001: {Y1,Y0,Z} = 3'b000;
4'b001?: {Y1,Y0,Z} = 3'b010;
4'b01??: {Y1,Y0,Z} = 3'b100;
4'b1???: {Y1,Y0,Z} = 3'b110;
endcase
end
endmodule
add a comment |
Here is a variant based on your code which works. The idea is that you check using the first '1' in the Ds and stop checking after it. To check them you can use bitwise &
.
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
integer i;
reg flag;
always @* begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
else begin
flag = 0;
for (i=3; i>=0; i=i-1) begin
if (flag == 0 && ({D3,D2,D1,D0} & (4'b0001 << i)) != 0) begin
flag = 1;
{Y1, Y0} = i;
Z = 1'b0;
end
end
end
end
endmodule
The other version is much simpler and more readable in your case:
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
always @* begin
casez({D3,D2,D1,D0})
4'b0000: {Y1,Y0,Z} = 3'b001;
4'b0001: {Y1,Y0,Z} = 3'b000;
4'b001?: {Y1,Y0,Z} = 3'b010;
4'b01??: {Y1,Y0,Z} = 3'b100;
4'b1???: {Y1,Y0,Z} = 3'b110;
endcase
end
endmodule
add a comment |
Here is a variant based on your code which works. The idea is that you check using the first '1' in the Ds and stop checking after it. To check them you can use bitwise &
.
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
integer i;
reg flag;
always @* begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
else begin
flag = 0;
for (i=3; i>=0; i=i-1) begin
if (flag == 0 && ({D3,D2,D1,D0} & (4'b0001 << i)) != 0) begin
flag = 1;
{Y1, Y0} = i;
Z = 1'b0;
end
end
end
end
endmodule
The other version is much simpler and more readable in your case:
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
always @* begin
casez({D3,D2,D1,D0})
4'b0000: {Y1,Y0,Z} = 3'b001;
4'b0001: {Y1,Y0,Z} = 3'b000;
4'b001?: {Y1,Y0,Z} = 3'b010;
4'b01??: {Y1,Y0,Z} = 3'b100;
4'b1???: {Y1,Y0,Z} = 3'b110;
endcase
end
endmodule
Here is a variant based on your code which works. The idea is that you check using the first '1' in the Ds and stop checking after it. To check them you can use bitwise &
.
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
integer i;
reg flag;
always @* begin
if ({D3,D2,D1,D0} == 4'b0000)
{Y1,Y0,Z} = 3'b001;
else begin
flag = 0;
for (i=3; i>=0; i=i-1) begin
if (flag == 0 && ({D3,D2,D1,D0} & (4'b0001 << i)) != 0) begin
flag = 1;
{Y1, Y0} = i;
Z = 1'b0;
end
end
end
end
endmodule
The other version is much simpler and more readable in your case:
module priorityenc_behav( D0, D1, D2, D3, Y0, Y1, Z);
input D0, D1, D2, D3;
output reg Y0, Y1, Z;
always @* begin
casez({D3,D2,D1,D0})
4'b0000: {Y1,Y0,Z} = 3'b001;
4'b0001: {Y1,Y0,Z} = 3'b000;
4'b001?: {Y1,Y0,Z} = 3'b010;
4'b01??: {Y1,Y0,Z} = 3'b100;
4'b1???: {Y1,Y0,Z} = 3'b110;
endcase
end
endmodule
answered Nov 16 '18 at 2:52
SergeSerge
3,82721015
3,82721015
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53316518%2fdealing-with-priority-encoder-when-output-is-described-by-3-seperate-signals%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
start with using the bitwise
or
instead of the comparison:if ( ( (2**i) | {D3,D2,D1,D0})) != 0)
. This will ignore other '1'.– Serge
Nov 15 '18 at 11:58
but thats the purpose of writing that(mine). to ignore other ~1~ and only those with 1 ~1~ will make the statement true. Your statement has no logical meaning (maybe)
– lowspacetop
Nov 15 '18 at 13:06
prevent* not ignore
– lowspacetop
Nov 15 '18 at 13:15
then explain it better. You said that you need the first (most significant) '1'. I did not say that your program will work as is, but this would help you to figure out the rest. If this is too complicated, try to use
casez
instead.– Serge
Nov 15 '18 at 13:27
i explained ,added truth table and examples and also noted the part of the code that needs correction and completion. i dont think much more can be explained. but appreciate it. and y using case will help but i need to find that particular solution
– lowspacetop
Nov 15 '18 at 13:34