how to write code for this? [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 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.

Related

What is the best way to isolate these local areas by intensity? [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 3 years ago.
Improve this question
The general task is to binarize the image so that only the brightest spots remain. But adaptive binarization and the Otsu method do not give an acceptable result due to light traces (shown in the image).
I think that you need to go through the entire image with a small window that will highlight a local minimum in the area.I am counting on the fact that with the correct selection of the threshold, only light spots will remain that need to be found. It should be. But I do not know how to apply the standard opencv threshold function in sliding windows.
UPD:After the proposed adaptive threshold, the image looks like this. Not perfect, but much closer to what I need.It seems that a combination of threshold functions does not always give a better result than a single one.
This is the command:
outputimg = cv.adaptiveThreshold(img,255,cv.ADAPTIVE_THRESH_MEAN_C,cv.THRESH_BINARY,11,0)
further explanation and examples: https://docs.opencv.org/3.4/d7/d4d/tutorial_py_thresholding.html

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))

Vivado HLS_C code [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 5 years ago.
Improve this question
I am trying to write and execute the C code program for data communication. Please can anyone help me in writing the Program for HLS?
Tried in normal C code program like using PRINTF and SCANF statements but it's showing a compilation error.
When you use HLS you are going to "translate" your C code in HLD (VHDL or Verilog for example). Because of this, there are some restrictions: you cannot use "printf", "scanf", malloc and so on. For instance: how can you implement a printf in HLD upon an FPGA?
I recommend reading this tutorial and this user guide.
However, you can use "printf" ONLY in HLS simulation: at the end, you will not synthesize it. Here you can find the link to the discussion about this on Xilinx's forum.
You can update your question and add some more details in order to understand where the errors occur.

How to avoid scientific notation for large numbers in verilog? [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 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

Effects of sound multiplication [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 years ago.
Improve this question
What are the effects of multiplication of two different sound? An neither of them are constant, like two different songs, or one track of instrumental and one of vocals.
A simple Google search came up with this:
http://crca.ucsd.edu/~msp/techniques/v0.11/book-html/node77.html
Did you search for it at all?
But basically what happens is you end up creating an envelope where the second acts as a "coefficient" of sorts.
You also end up with a reduction of sound levels (since a decimal times a decimal is less both of them), so you'll need to amplify the signal a bit to retain volume.
The page I linked gives a lot more explanation and has a lot of the algebra needed to write up a code to implement it. Look there if you have any more questions.

Resources