Code and Bugs

Coding things

Category: Open Source

A Puzzle and a Solution

Let’s say we have a number N of children placed in a circle and playing the following simple game: proceeding around the circle they kick out every Pth of them (of course, P < N).

Of course, what we will obtain is a permutation of the first N natural numbers. The puzzle asks for the order of this permutation (that is the number of times it must be applied to itself to get back to an ordered list.

Read the rest of this entry »

Doxygen to the rescue

I was writing a homework from the Computer Graphics Course in C++ these days. Nearly 3000 lines of code and not all of the wanted by myself features included. The only problem was navigating through the many classes I have created (I rember that at one point I was thinking that I was using one kind of Object but this was not real).

Hopefully, I knew that doxygen can generate graphical views of the documentation. So, I’ve used another rule of my standard makefile and voila, just by using the images alone, I was able to understand where I was mistaken.

Here is one result generated by doxygen (reduced to thumbnail because of the size).

class Universe coll graph

VHDL Makefile

Here is a short example for the Makefile I’m currently using to compile and test my VHDL project:

.PHONY: all clean testbench
 
VCDFILE = tmp
STOPTIME = 42ns
DEBUG = --vcd=$(VCDFILE) --stop-time=$(STOPTIME)
CLEANUP = rm -f $(VCDFILE)
OBJS = clock.o
TARGET =
 
all:
        make test
 
clean:
        ghdl --clean
 
testbench:
        ghdl -m $(TARGET)
        ghdl -r $(TARGET) $(DEBUG)
        gtkwave $(VCDFILE)
        $(CLEANUP)

Which is used in a terminal (providing you have gtkwave and ghdl installed) as follows:

$ make testbench TARGET=Chien_tb

Hoping to be useful, I’ll retire. I’ll be back in a few weeks with more details.

Verilog and VHDL on Linux (Ubuntu)

For those interested in programming electronic components there is always the possibility to use Xilinx if you are on Windows. Of course, there is a Xilinx port for Linux but it is buggy application and a very large download. This article aims to give an alternative to this application. One that will need only a few KB of download from an apt-get source.

Read the rest of this entry »

Uniformity

Suppose we have to make a quiz. The questions have different degrees of difficulty and come from several different chapters. We have the following problem:How can we ensure that we select the questions uniformly from both domains?

Read the rest of this entry »

Eliberatica

The last two days I participated at the third edition of the eLiberatica Open Source Conference. This time, it was held at the Politehnica University of Bucharest and many students were present there.

Though this has nothing to do with coding, I will post here a summary of the events held there.

Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.