Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

Problem with VHDL code for 74LS192..

Status
Not open for further replies.

Code_Nerd

Newbie level 2
Joined
Oct 13, 2005
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
Hello, I am new to VHDL programming and am having trouble with my code for a 74LS192. The problem lies with this device having 2 clocks I think? Anyway my code is below, could you please point out any areas where I have gone wrong if possible?
Thankyou
Code:
library ieee;
library cypress;
use ieee.std_logic_1164.all;
use cypress.std_arith.all;

entity mod10 is

port (

cpu, cpd, clr, load : in std_logic;
tcu, tcd : buffer std_logic;
data_in : in std_logic_vector(3 downto 0);
count_value : buffer std_logic_vector(3 downto 0) );

end mod10 ;


architecture behav of mod10 is

begin

count_proc : process (cpu, cpd, clr, load)

begin

		if (clr = '1') then
			count_value <= "0000" ;

		elsif (load = '0') then
 	    	count_value <= data_in ;

		elsif (cpu'event and cpu = '1') then 

			if (cpd ='1' and count_value = "1001") then
	    		count_value <= "0000" ;

			elsif (cpd = '1' and count_value < "1010") then
				count_value <= count_value + 1 ;

			elsif (cpd'event and cpd = '1') then

				if (cpu = '1' and count_value = "0000") then 
					count_value <= "1001" ;

				elsif (cpu = '1' and count_value > "0000")then
					count_value <= count_value - 1;

		 else count_value <= count_value ;

		 end if ;

		 end if ;

		 end if ;

	
end process count_proc;

tcu <= '0' when (count_value = "1001") else '1' ;
tcd <= '0' when (count_value = "0000") else '1' ;


end behav ;
 

Your attempt of writing VHDL code for 74LS192 is OK! But the style you are using
is not correct You know the internal circuit of 74LS192 use structural coding style
to code such a old design. This kind of design is not recomended for new technology!
This one is asynchronous design. Only way to describe this in vhdl is using structural
coding! Anyway you are on right track!!
Hope this hint helps!
 

You have to use single clk in one process statement bcos fif never have two differnt clks. For sort out your problem u have to physically OR two clks(cpd and cpu) & used as single clk' event in process statement.On clk' event also u have to check state of up or down signal .Bcos when 1st have clk anather will be permanently high & viceversa.
 

Thankyou for your replies..
Have it sorted out now :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top