- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have asked to write compare machine which compare 2 numbers with 4 bits. I made it by ussing XOR. My outputs dont react to the change in the inputs, they undefined. The inputs works well with my test bench. You can see my code at attached files.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dont post images, post the actual code.
The problem probably occurs because you have a local variable i, and a while loop. The variable is probably gets to -1 on the first iteration and then the code is never executed again. But the main problem with the code is that while loops are not synthesisable. You will need to change the code to remove the loops.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have 2 question
1. I made initialize to i=3 don't i?(line 17) 2. what you mean in "while loops are not synthsisable"? and which other way can i implement the component? thanks- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
VHDL code is not a sequential program which a cpu is supposed to execute, so a while loop makes no sense.
VHDL is rather a description language: you are supposed to 'describe' logic gate connections. Any VHDL code which is not convertible (we call this 'synthesizable') in terms of logic gates, signals and flip-flops will not work and can not work. As you pointed out, a while loop is good only for a test bench and simulation, where you actually need to generate artificially some sequential input states. VHDL Usually a comparator is conveniently described in VHDL with high level operators > and <. If you want to follow your 'bare metal' approach, you can use the 'generate' statement, like in the following example: http://fpgacenter.com/digit_dsgn/log_gates/comparator.php
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page