Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to implement Barker code in VHDL


Junior Member level 2
May 11, 2022
Reaction score
Trophy points
Activity points

I am trying to implement an FIR filter in VHDL. The filter coefficients are 11-tap Barker sequences {1, 1, 1, –1, –1, –1, 1, –1, –1, 1, –1}, to which I have to feed a complex data written in a file. The data file contains 20,000 data values of integer type. My question would be, when doing convolution, do we have to convert the data from integer to binary and do convolution bitwise with 11-tap Barker sequence, or we do the convolution directly with the samples i.e. {a1 + jb1, a2 + jb2,..........., aN + jbN} in VHDL? My strategy is to split the real and complex parts into separate files, convolute them separately with Barker sequences, and then add the results together since convolution is a linear operation.

As an example, a1 = 1623. a1 is an integer having binary value of 0110_0101_0111. The problem is whether element-by-element i.e. {1623}*{Barker} OR {0110_0101_0111}*{Barker}.

WHich one of these is correct?

For ex, is this entity declaration correct?

entity lab12 is
    Port ( clk  : IN std_logic;`
        din : IN integer;
        dout : OUT integer;
end entity lab12;

I am a newbie in DSP.

Last edited:
do we have to convert the data from integer to binary
"integer" and "binary" are two different things.

--> INTEGER is a data format. Let´s say "one byte unsigned integer" = uint8
other examples: float, char, int32 ...

The information of this uint8 is stored in 1 byte = 8 bits.

--> BINARY is just a form of representation. ... how a value is "visualized" (for human eyes).

Let´s say you have a uint8 variable containing the value of 65 (decimal)
It is stored in the 8 bits like this: 0-1-0-0-0-0-0-1
You may represent this value
* as 0b01000001 (binary)
* as 0x41 (HEX)
* as "A" (ASCII)
* or many other formats (without the need for converting it on the microcontroller, since it´s always the same 8 bits)

it does not matter how you "visualize" it, it will always be the same 8 bits (0-1-0-0-0-0-0-1) in the memory. All is the same for the computer.
--> No need to convert (process) it at all.

But you need to convert (process) the data when you need to transfer them into a different dataformat.
uint8, 0x93 --> uint16, 0x0093 (decimal: 147)
int8, 0x93 --> int16, 0xFF93 (decimal: -109)
uint8, 0x93 --> float32, 0x43130000
int8, 0x93 --> float32, 0xC2DA0000

(btw: all have the same bitwise input value. All different data formats are represented in the same HEX format. Unless .. the obvious)


LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to