The Devil In The Detail

Important Notes that forgotten [mulyanto at gmail dot com]

Archive for the ‘VHDL Collection’ Category

Divider Architecture

Posted by mulyanto on January 4, 2008

Parallel Divider Architecture :

parallel-divider.jpg

Here is the example Verilog divider code : divider.pdf

Serial Divider Architecture :

serial-divider.jpg

(click the image to enlarge)
divider.pdf

Posted in Tutorial, VERILOG Collection, VHDL Collection | 4 Comments »

Integer to String and String Concatenation in VHDL

Posted by mulyanto on August 23, 2007

First, make a library called vsilicon (you can use another name). This library constructed from modelsims textio.vhd. The textio.vhd modified and renamed as textio_vs.vhd in order to avoid library error. The Int_to_string procedure/function in textio.vhd also renamed as Int_to_string_vs in textio_vs.vhd. All constant/subtype/variable also renamed for the similar reason. Here is the textio_vs.vhd.(textio_vs.pdf)

on your modelsim prompt, type:

vlib vsilicon
vcom -93 -work vsilicon ../../lib/vsilicon/sim/TEXTIO_VS.vhd

Put the library on your tesbench/design

library vsilicon;
use vsilicon.TextIO_VS.all;

Now you can call Int_to_string_vs function in your tesbench/design.

Example:

verilog_parameter_interface : process
file WFile: Text;
variable LW: Line;
variable IW: integer;
variable last: integer;
variable SW: string(1 to 22);
variable CW: string(1 to 2);
variable NW: string(1 to 20);
variable first : integer := 1;

begin

if (first = 1) then
File_Open(WFile, “leon3parameters.v”, Write_Mode);

CW := Int_to_string_vs(romwidth);
NW := “`define romwidth “;
SW := NW & CW;
WRITE(LW, SW);
WriteLine(WFile, LW);

CW := Int_to_string_vs(romdepth);
NW := “`define romdepth “;
SW := NW & CW;
WRITE(LW, SW);
WriteLine(WFile, LW);

CW := Int_to_string_vs(sramwidth);
NW := “`define sramwidth “;
SW := NW & CW;
WRITE(LW, SW);
WriteLine(WFile, LW);

CW := Int_to_string_vs(sramdepth);
NW := “`define sramdepth “;
SW := NW & CW;
WRITE(LW, SW);
WriteLine(WFile, LW);

File_Close(WFile);
first := 0;
end if;
wait;
end process;

Posted in Modelsim, Tutorial, VHDL Collection | Leave a Comment »

Design Examples For Xilinx University Program XUP Virtex-II Pro Development System : RS232 Interface

Posted by mulyanto on June 22, 2007

Posted in Tutorial, VERILOG Collection, VHDL Collection, Xilinx | 13 Comments »

Design example of Games (VGA) for Altera UP1/UP2 board

Posted by mulyanto on June 19, 2007

This is an incremental design, consist of 5 complexity stage. Learn the design by starting from road-game-01, then you can go to the next design, road-game-02.

1. road-game-01

2. road-game-02

3. road-game-03

4. road-game-04

5. road-game-05

Posted in Altera, Tutorial, VHDL Collection | 2 Comments »

Modelsim and Synopsis example : RISC

Posted by mulyanto on June 19, 2007

A design of SRM processor (Simple RISC Microprocessor).
Download the documentation here
Download the design files here

The design files incude the synopsys script.

Posted in Modelsim, Tutorial, VHDL Collection | Leave a Comment »

Interfacing text file in VHDL using readline and writeline

Posted by mulyanto on May 31, 2007

You can use the readline and writeline in VHDL like the readln and writeln in c code. For further information about readline and writeline read the $Modeltech\vhdl_src\std\textio.vhd.

Download here, the example of readline and writeline :

readline.jpg

Posted in Tutorial, VHDL Collection | Leave a Comment »

Using Conv_Integer for behavioral memory design in VHDL

Posted by mulyanto on May 31, 2007

If you plan your design will be implemented in FPGA, you have use the syncronous memory. In the simulation phase, you can use the generic behavioral memory design, but in the fpga implementation phase you have change the generic behavioral memory into the vendor memory(Xilinx Core or Altera Megafunction).

Here is the generic behavioral memory code :

sincram1.jpg

Posted in Tutorial, VHDL Collection | 2 Comments »

Register with scan port

Posted by mulyanto on May 9, 2007


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity reg32sc is
port (
sc_in : in std_logic;
sc_en : in std_logic;
sc_out : out std_logic;
clk : in std_logic;
rst : in std_logic;
ena : in std_logic;
d : in std_logic_vector (31 downto 0);
q : out std_logic_vector (31 downto 0)
);
end reg32sc;

architecture reg32sc_rtl of reg32sc is
signal mem : std_logic_vector (31 downto 0);
signal q_s : std_logic_vector (31 downto 0);
begin

mem

Posted in Tutorial, VHDL Collection | Leave a Comment »

LFSR Testbench

Posted by mulyanto on March 21, 2007

Posted in VHDL Collection | Leave a Comment »