How to avoid scientific notation for large numbers in verilog? [closed] - verilog

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In a case statement case(s), the nvalue of s is increased by the power of 2.
input[127:0] s
output[127:0] y
case(s)
128'b1: y=a1;
128'b2: y=a2;
...
When it goes to 2^64, the number is so big and it will be represented automatically by scientific notation, eg.
128'b1.84467e19: y=a64
This will give me a syntax error, is there a way to avoid this?
I don't want to define it as real, since I want to synthesise this code.

If only one bit of s is set (one-hot), you might be able to use "Constant expression in case statement" (see ยง12.5.2 of the free IEEE Std 1800-2012):
case (1'b1)
s[0] : y=a1;
s[1] : y=a2;
s[127]: y=a64;
endcase

Related

How to differentiate two forms of percent in a grammar? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 months ago.
Improve this question
I have two forms of "percent" that I need in a grammar:
PERCENT_1
: 'PERCENT'
;
PERCENT_2
: '%'
;
One is the word PERCENT, for example used with something like LIMIT 10 PERCENT and the other is the modulo operator. What might be a good way to differentiate these two things?
One is a keyword, the other an operator. I usually name keyword tokens <name>_SYMBOL and operators <name>_OPERATOR (see the MySQL grammar). Of course this is totally up to you, but should be consistently used throughout your grammar(s).

Seating arrangement problem in a circular table [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
N people sit around a circular table. You have to find the probability that two particular people won't be sitting together.
The input will have the number N and the output should have the probability printed as a float type number rounded off to four decimal places.
Here's the link for the derived formula
You can find the step by step derivation over there
Here's the simple python implementation as per the thread
n = 5
result = (n-3)/(n-1)
print(result)
n= int(input())
import math
print(round(1-math.factorial(n-2)*math.factorial(2)/math.factorial(n-1),4))

which one is best for parsing between Left corner Parsing algorithm and CYK parsing algorithm ? and Why? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
which one is best for parsing between Left corner Parsing algorithm and CYK parsing algorithm ? and Why ?
Generally speaking, CYK is a maximum-likelihood parse tree. It never gives you the best performance because of this reason and the fact that it ignores contextual information when assigns the probabilities. You need to modify it to consider more contexts, or integrate it into something else. For example, Left-Corner parser can use a CYK procedure, inside. So the answer to your question is, LC is more powerful than CYK, though it's computationally more expensive. Have a look at Mark Johnson's paper.

how to write code for this? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
In Verilog HDL describe a hardware that is able to generate a clock frequency f 0 of approximately 3Hz. Display this clock by connecting it to LED LD7 to verify your approach.
I tried a lot but not able to get right output.
Device:-Basys2 Spartan3e
I will give the steps(not the code) to create a clock divider which is what you need here.
Say you clock has frequency f. Create a counter which counts from 1 to f/2.
Say your new divided clock name is clk_new. Initialize this clk_new to zero.
Whenever the counter value is in its maximum (which is f/2), toggle clk_new.
you can do this by clk_new = ~clk_new;
and also reset the counter to zero and let it begin the counting again.
Write the code and if it doesnt work, post here. We can help.

What does '%8.1fC\n' mean? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I wanted to know the purpose of a percent inside a string with 8.1. Your help will be appreciated thanks.
%8.1f is a format specifier. This should point you in the right direction for figuring out what all the parts mean. It specifies the format in which a variable will be printed. In this specific case, it is a place-holder for a floating point variable. It reserves a width of at least 8 characters and a precision of 1.
For more information, do some research on format specifiers. It's an extremely well documented and widely available topic for virtually every programming language.

Resources