caramoan tour package

caramoan tour package

Author Topic: Hello World using E-gizmo's CPLD board  (Read 15456 times)

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #140 on: April 08, 2010, 08:47:57 AM »
go!! galawin mo... ilipat mo na lalagyan! itabi mo sa mga panties mo! hehehe ;D

;D ;D ;D

yung CPLD ko din di ko pa nagagalaw, medyo marami pang ginagawa pero for sure gagamitin ko din yun :D

btw, ano mas magandang pag-aralan muna? VHDL o Verilog?
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #140 on: April 08, 2010, 08:47:57 AM »

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4158
  • Pogi/Ganda Points: 165
  • Gender: Female
  • A journey to a thousand lines begins w/ LED Blink
    • Underground Workbench
Re: Hello World using E-gizmo's CPLD board
« Reply #141 on: April 08, 2010, 09:54:51 AM »
;D ;D ;D

yung CPLD ko din di ko pa nagagalaw, medyo marami pang ginagawa pero for sure gagamitin ko din yun :D

btw, ano mas magandang pag-aralan muna? VHDL o Verilog?

sa aking pananaw mas maganda ang VHDL kasi standard yun although marami na rin nagsusupport ng verilog.
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #141 on: April 08, 2010, 09:54:51 AM »

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Hello World using E-gizmo's CPLD board
« Reply #142 on: April 08, 2010, 11:44:37 AM »
sa tingin ko, kahit alin naman dyan. but personally, i din't like verilog kasi parang jumbled words lang... no offense sa verilog lovers. hehehe ;D

I prefer VHDL, kasi yan yun una kong natutunan! ;D ;D ;D
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #142 on: April 08, 2010, 11:44:37 AM »

Offline ckiana02

  • CR2032 Battery
  • **
  • Posts: 46
  • Pogi/Ganda Points: 3
Re: Hello World using E-gizmo's CPLD board
« Reply #143 on: April 08, 2010, 03:19:46 PM »
If you know how to program using c then go for verilog.  From experience (I teach both VHDL and Verilog), it is much easier to program in verilog however it is also easier to make mistakes using verilog.  VHDL is structured and has strict code checking.  So if you do not know how to program using c then go for VHDL :-)
 

Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #143 on: April 08, 2010, 03:19:46 PM »

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Hello World using E-gizmo's CPLD board
« Reply #144 on: April 08, 2010, 03:52:36 PM »
^sir sa tingin ko po, sanayan din. I know C before i studied VHDL. ngayon, VHDL ang tinuro sa school, kaya VHDL na din ako. ;D ;D ;D
para po saakin, HDL in general (VHDL or Verilog ) is very easy to code when you already know C. Example po sa processes like IF-ELSE conditions... having to know C, you can easily grasp a sample code. Yung mga headers and initializations (instantiations) lang nalang ang poproblemahin - like entity, etc. Kung sa formatting naman, nagkakalat naman yun references sa internet so walang problema.

what I like most about HDL is even you use different IDE (like Quartus of Altera and ISE of Xilinx), the code could still work. Very standard. :) sabagay, medyo bago palang naman ang VHDL standard.

will try Verilog din, someday.

"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #144 on: April 08, 2010, 03:52:36 PM »

Offline ckiana02

  • CR2032 Battery
  • **
  • Posts: 46
  • Pogi/Ganda Points: 3
Re: Hello World using E-gizmo's CPLD board
« Reply #145 on: April 13, 2010, 03:12:26 PM »
Below are examples of verilog and VHDL codes.  These are equivalent codes for a circuit that counts 0 to 7 with synchronous clear.

Verilog
Code: [Select]
//circuit that counts 0 to 7 with clear in verilog
module cnt8(clk, clr, q);
input clk, clr;
output [2:0] q;

reg [3:0] q;
always @ (posedge clk)
  if (clr) q <= 0;
  else     q <= q + 1; 
         
endmodule
//end of cnt8 design


//test bench for cnt8
module tb();
reg clk, clr;
wire [2:0] q;

cnt8 uut(clk, clr, q);

initial
begin
 clk = 0; clr = 1;
 #30 clr = 0;
 #1000 $finish;
end

//40 ns clock generation
always #20 clk = !clk;

endmodule




VHDL
Code: [Select]
--circuit that counts 0 to 7 with clear in VHDL
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;

ENTITY cnt8 IS
  PORT( clr, clk : IN std_logic;
               q : OUT std_logic_vector (2 downto 0));
  END;

ARCHITECTURE logic OF cnt8 IS
SIGNAL tmp : std_logic_vector (2 downto 0);
BEGIN

   count: PROCESS (clr, clk)
   BEGIN
         IF (clr = '1') THEN
                  tmp <= "000";
         ELSIF (clk'EVENT and clk = '1') THEN
                  tmp <= tmp + 1;
          END IF;
    END PROCESS;
   
     q <= tmp;

END logic;
--end of cnt8 design

--test bench for cnt8
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;
   
ENTITY cnt8test IS
END;

ARCHITECTURE testxxxx OF cnt8test IS
SIGNAL clk : std_logic := '0';
SIGNAL clr : std_logic := '1';
SIGNAL q : std_logic_vector (2 downto 0) ;

COMPONENT cnt8
  PORT( clr, clk : IN std_logic;
               q : OUT std_logic_vector (2 downto 0));
END COMPONENT; 

BEGIN
UUT: cnt8 PORT MAP (clr, clk, q);

--40 ns clock generation
PROCESS
BEGIN
  clk <= '0';
  wait for 20 ns;
  clk <= '1';
  wait for 20 ns;
END PROCESS;

--clear generation
PROCESS
BEGIN
    wait for 30 ns;
    clr <= '0';
END PROCESS;

END;





Offline celdricg

  • Size AA Battery
  • ****
  • Posts: 113
  • Pogi/Ganda Points: 3
    • http://www.bobongbooks.com/
Re: Hello World using E-gizmo's CPLD board
« Reply #146 on: April 14, 2010, 05:39:55 PM »
di ko pa natry verilog at wala pa ako balak subukan yun.. VHDL muna tayo

Offline gentleman

  • Size AAA Battery
  • ***
  • Posts: 94
  • Pogi/Ganda Points: 8
  • Gender: Male
  • Aim High...
Re: Hello World using E-gizmo's CPLD board
« Reply #147 on: April 15, 2010, 11:38:57 AM »
ako din vhdl din ang ginamit ko sa last project ko sa fpga. Question, magkano ang cpld board sa e-gizmo tsaka pahingi ng link di ko kasi makita eh. thanks
The beginning of knowledge is knowing that you don't know everything...

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Hello World using E-gizmo's CPLD board
« Reply #148 on: April 15, 2010, 12:03:48 PM »
ako din vhdl din ang ginamit ko sa last project ko sa fpga. Question, magkano ang cpld board sa e-gizmo tsaka pahingi ng link di ko kasi makita eh. thanks


http://www.e-gizmo.com/KIT/CPLD.htm
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline gentleman

  • Size AAA Battery
  • ***
  • Posts: 94
  • Pogi/Ganda Points: 8
  • Gender: Male
  • Aim High...
The beginning of knowledge is knowing that you don't know everything...

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #150 on: May 04, 2010, 12:33:41 AM »
sisimulan ko na ito :D :D :D para magamit ko na ang CPLD kit ng e-gizmo :D :D :D
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #151 on: May 13, 2010, 10:18:40 AM »
Below are examples of verilog and VHDL codes.  These are equivalent codes for a circuit that counts 0 to 7 with synchronous clear.

Verilog
Code: [Select]
//circuit that counts 0 to 7 with clear in verilog
module cnt8(clk, clr, q);
input clk, clr;
output [2:0] q;

reg [3:0] q;
always @ (posedge clk)
  if (clr) q <= 0;
  else     q <= q + 1; 
         
endmodule
//end of cnt8 design


//test bench for cnt8
module tb();
reg clk, clr;
wire [2:0] q;

cnt8 uut(clk, clr, q);

initial
begin
 clk = 0; clr = 1;
 #30 clr = 0;
 #1000 $finish;
end

//40 ns clock generation
always #20 clk = !clk;

endmodule




VHDL
Code: [Select]
--circuit that counts 0 to 7 with clear in VHDL
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;

ENTITY cnt8 IS
  PORT( clr, clk : IN std_logic;
               q : OUT std_logic_vector (2 downto 0));
  END;

ARCHITECTURE logic OF cnt8 IS
SIGNAL tmp : std_logic_vector (2 downto 0);
BEGIN

   count: PROCESS (clr, clk)
   BEGIN
         IF (clr = '1') THEN
                  tmp <= "000";
         ELSIF (clk'EVENT and clk = '1') THEN
                  tmp <= tmp + 1;
          END IF;
    END PROCESS;
   
     q <= tmp;

END logic;
--end of cnt8 design

--test bench for cnt8
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;
   
ENTITY cnt8test IS
END;

ARCHITECTURE testxxxx OF cnt8test IS
SIGNAL clk : std_logic := '0';
SIGNAL clr : std_logic := '1';
SIGNAL q : std_logic_vector (2 downto 0) ;

COMPONENT cnt8
  PORT( clr, clk : IN std_logic;
               q : OUT std_logic_vector (2 downto 0));
END COMPONENT; 

BEGIN
UUT: cnt8 PORT MAP (clr, clk, q);

--40 ns clock generation
PROCESS
BEGIN
  clk <= '0';
  wait for 20 ns;
  clk <= '1';
  wait for 20 ns;
END PROCESS;

--clear generation
PROCESS
BEGIN
    wait for 30 ns;
    clr <= '0';
END PROCESS;

END;





mukhang kelangan ko din pag aralan mag code ng test bench sa VHDL para mas macustomize ko mga kailangan kong itest... right now kasi gamit ko yung wizard sa pag-gawa ng test bench using Xilinx ISE (pang tamad ba? hehe)..

ganda point sa iyo ckiana02 ... ;D
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline glutnix_neo

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4158
  • Pogi/Ganda Points: 165
  • Gender: Female
  • A journey to a thousand lines begins w/ LED Blink
    • Underground Workbench
Re: Hello World using E-gizmo's CPLD board
« Reply #152 on: May 13, 2010, 11:48:17 AM »
hindi ko pa magrasp concept ng test bench, nalipat attention ko sa arduino, processing, at mobile processing eh, ;D ;D ;D

tutorial naman master 7.
If we hear,we forget;if we see, we remember;if we do,we understand.
Let's support the use of free and open source softwares...
http://UndergroundWorkbench.wordpress.com

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #153 on: May 13, 2010, 01:56:52 PM »
^^

sis glutnix basic na basic pa lang ang mga nalalaman ko :D nakakahiya pa magshare :D antayin natin si marcelina at ckiana02 para sa mga bagay bagay na yan :D madami din akong gustong malaman tungkol sa test bench na yan :D :D :D
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Hello World using E-gizmo's CPLD board
« Reply #154 on: May 13, 2010, 05:07:21 PM »
^^

sis glutnix basic na basic pa lang ang mga nalalaman ko :D nakakahiya pa magshare :D antayin natin si marcelina at ckiana02 para sa mga bagay bagay na yan :D madami din akong gustong malaman tungkol sa test bench na yan :D :D :D


wag mo naman ako sis asahan... heheh ;D di naman ako magaling. may alam lang.

pero ganito ang pagkakaintindi ko ng testbech.
kung halimbawa, gumawa tayo ng isang program, for instance a 2-input AND gate (syempre may 1-output yan). Sa testbench, ilalagay mo ang lahat na possible test na gusto mo. for AND gate, syempre, 00, 01, 10 and 11. lalayan mo ito ng time component para makita mo sa simulation kung tama nga ang pagkakadesign mo ng 2-input AND gate.

sa example code ni sir ckiana02, counter with clear. kung maoobserbahan mo, yung entity nya
Code: [Select]
ENTITY cnt8 IS
  PORT( clr, clk : IN std_logic;
               q : OUT std_logic_vector (2 downto 0));
  END;
may 2 inputs, clr and clk.

yung testbench, naggenerate ng input which is the clock and clear:
Code: [Select]
BEGIN
UUT: cnt8 PORT MAP (clr, clk, q);

--40 ns clock generation
PROCESS
BEGIN
  clk <= '0';
  wait for 20 ns;
  clk <= '1';
  wait for 20 ns;
END PROCESS;

--clear generation
PROCESS
BEGIN
    wait for 30 ns;
    clr <= '0';
END PROCESS;

END;




"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #155 on: May 13, 2010, 05:11:31 PM »
wow thanks... at isa pang tanong, STD_LOGIC ba kalimitang ginagamit? kasi may natesting ko, BIT yata yun iirc, ayaw magcompile ng Test Bench, pinalitan ko ng STD_LOGIC gumana na...
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Hello World using E-gizmo's CPLD board
« Reply #156 on: May 13, 2010, 06:03:27 PM »
wow thanks... at isa pang tanong, STD_LOGIC ba kalimitang ginagamit? kasi may natesting ko, BIT yata yun iirc, ayaw magcompile ng Test Bench, pinalitan ko ng STD_LOGIC gumana na...

ako sis, laging STD_LOGIC ang gamit ko. di pa ako nakakagamit ng BIT. siguro specific yung BIT sa include header.
Code: [Select]
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;

di ako sigurado nyan. pero di pa ako nakakakitang VHDL na may BIT.
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Hello World using E-gizmo's CPLD board
« Reply #157 on: May 13, 2010, 06:08:54 PM »
ok, yung STD_LOGIC na din lagi kong gagamitin :D ;D
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1878
  • Pogi/Ganda Points: 243
  • Gender: Male
  • Been at this longer than you've been alive.
Re: Hello World using E-gizmo's CPLD board
« Reply #158 on: May 14, 2010, 01:23:52 PM »
Quote
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_unsigned.all;

If you "use" the above libraries, you can find the definition of STD_LOGIC in the files "std_logic_1164.vhd" and "std_logic_unsigned.vhd". In the file "std_logic_1164.vhd", you can also discover what operations are available if that file is "used".

Code: [Select]
    -------------------------------------------------------------------   
    -- logic state system  (unresolved)
    -------------------------------------------------------------------   
    TYPE std_ulogic IS ( 'U',  -- Uninitialized
                         'X',  -- Forcing  Unknown
                         '0',  -- Forcing  0
                         '1',  -- Forcing  1
                         'Z',  -- High Impedance   
                         'W',  -- Weak     Unknown
                         'L',  -- Weak     0       
                         'H',  -- Weak     1       
                         '-'   -- Don't care
                       );
    -------------------------------------------------------------------   
    -- unconstrained array of std_ulogic for use with the resolution function
    -------------------------------------------------------------------   
    TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) OF std_ulogic;
                                   
    -------------------------------------------------------------------   
    -- resolution function
    -------------------------------------------------------------------   
    FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic;
   
    -------------------------------------------------------------------   
    -- *** industry standard logic type ***
    -------------------------------------------------------------------   
    SUBTYPE std_logic IS resolved std_ulogic;


On Xilinx ISE, the files are found in the "C:\Xilinx\11.1\ISE\vhdl\src\ieee\" path.



"Set your mind free!"

Offline ckiana02

  • CR2032 Battery
  • **
  • Posts: 46
  • Pogi/Ganda Points: 3
Re: Hello World using E-gizmo's CPLD board
« Reply #159 on: May 14, 2010, 03:18:08 PM »
Medyo rusty na ako sa VHDL since I shifted to verilog 5 years ago :-).

BIT means logic 0 or 1 only (no high impedance, no undefined etc) as oppose to STD_LOGIC (as defined by motion 555).

BIT is precompiled into the library ”STD” (accessed via USE STD.STANDARD.ALL that is implicitely declared).
package standard is
type bit is (‘0’, ‘1’);

to explain the and example above i.e. making a testbench that will generate the input 00, 01, 10, 11 (cycles back) at an interval of 30 ns.

Code: [Select]
--this is a comment :-)

---------My_And
library ieee;
use ieee.std_logic_1164.all;

entity My_And is
  port(A, B  : in std_logic;
       ANDED : out std_logic);
end;

architecture BEHAVIOR of My_And is  

  ANDED <= A and B;      

end;
----------end of the circuit My_And

------------start of testbench
library ieee;
use ieee.std_logic_1164.all;

Entity testMy_And Is

end;

Architecture test Of testMy_And Is
Signal Ax : std_logic := '0'; --initial value of Ax
Signal Bx     : std_logic := '0'; --initial value of Bx
Signal ANDout : std_logic;

Component My_And --template of My_And described above
 Port(A, B  : in std_logic;
      ANDED : OUT std_logic);  
end component;

begin

UUT: My_And Port Map (Ax, Bx, ANDout);
--Ax maps to A, Bx maps to Bx and ANDout maps to ANDED

Process
begin
  wait for 30 ns; -- so Ax = 0, Bx = 0 for 30 ns
  Ax <= '0';  
  Bx <= '1';
  wait for 30 ns; -- so Ax = 0, Bx = 1 for 30 ns
  Ax <= '1';  
  Bx <= '0';
  wait for 30 ns; -- so Ax = 1, Bx = 0 for 30 ns
  Ax <= '1';  
  Bx <= '1';
  wait for 30 ns; -- so Ax = 1, Bx = 1 for 30 ns
  Ax <= '0';  
  Bx <= '0'; --will go back to the start of the process
end process;

end;



Philippine Electronics Forum

Re: Hello World using E-gizmo's CPLD board
« Reply #159 on: May 14, 2010, 03:18:08 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com