Clock Edge notation

On Mon, 2004-11-01 at 19:54 -0800, sirisha wrote:
Arithmetic operations are among the most basic instructions in
microprocessors and many other ASICs. From SPECfp2000 benchmark, about
15% of the floating-point ALU operations are additions and about 10%
are subtractions. The most time consuming arithmetic operation is the
floating-point division, then comes to the multiplication and then the
addition/subtraction. The speed of those arithmetic operations
directly links to the overall performance of the ALU units and so the
computers. Since floating-point addition/subtraction units are built
on top of integer addition/subtraction units, performance of integer
addition/subtraction units have direct link to performance of
floating-point units.

In this class project, we design 2 32-bit addition/subtraction units,
one uses straight simple ripple-carry algorithm and the other uses
carry-looked-ahead algorithm. Our study will basically explore the
correlations between areas, speeds, algorithms and will at least cover
the information as listed below. All analyses will be performed based
on both theory and measurements and explanation will be provided for
discrepancies between the twos.
ƒ 1)Correlation of areas and speeds for both algorithms will be
determined
2)The two designs will be optimized for areas and analysis on speeds
will be performed
3)The two designs will be optimized for speeds and analysis on areas
will be performed
4)Costs and speeds of a 32-bit floating-point unit if the unit is
built based on one addition/subtraction algorithm versus the other
will be relatively evaluated

This project start with verilog code. I am unable to start the
code.I need help from group.

Thanks
sirisha.
Here is some help to start the code:

module ripple(sum, opa, opb);

// you fill in the code here

endmodule
 
tesla wrote:

I am trying to learn VHDL but I have to learn first what code infers
what hardware.I mean I do not know which statements causes a FF, latch
or register or whatever exists in electronics.

I am reading tutorials but I could not find any specific and complete
description of

VHDL <= Hardware
Hardware <= VHDL reference.
Synthesis manuals have this sort of information.
Also look at some code examples:
http://groups.google.com/groups?q=vhdl+treseler+rising_edge+clock+OR+clk
Good luck.

-- Mike Treseler
 
I forgot to give you another very useful link to the comp.lang.vhdl
FAQ.

http://www.eda.org/comp.lang.vhdl/

--

Rick "rickman" Collins

rick.collins@XYarius.com
Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
I am not going to analyze all of your code, but I took a quick look and
I found at least one error. Your next state process is generating a
latch for the nextstate signal. This may not work improperly, but it is
not needed since your state is being clocked by a register. Change all
your if statements inside the nextstate process to have an ELSE part
specifying the same state it is in. Another possible problem is that
you are using equalsignalB to clock several things. This is generally
not a good idea. You should change the code so that you use a single
clock and any of these signal derived clocks are used as enables instead
of clocks.

Otherwise, to find your problems, you need to use a simulator and probe
the internal signals in your design.


john wrote:
Hello,

I interfaced two FPGAs with the Dual port RAM (SRAM). Dual port RAM
has 19 bit of address bus and 18 bit of data bus.I am using 14 bit of
data bus.

FPGA on the left hand side of the Dual port RAM is writing data to the
RAM, filling the DPR fully. So data is always there..

I am trying to implement the following scheme with the above mentioned
hardware.

Right hand side FPGA will generate the 19 bit address for the memory
and get the 14 bit data and concatenate that 14 bit data with the five
bit counter

number to generate another set of 19 bit address and retrived another
14 bit of data and send it to its destination.

So there is two kind of data in the memory, the one data is the Look
up table values and the other set of data is the refernce to the LUT
values.

I am implementing above scheme ( for Right hand side FPGA) with three
counters, one is 14 bit counter , two five bit counters, one five bit
multiplexer and

one fourteen bit multiplexer.

Now, the fourteen bit counter and the 14 bit data bus( out of 18 bit
data bus) are multiplexed through the 14 bit multiplexer. The two
five bit counters

are multiplexed through five bit multiplexer.

First the 14 bit mux. is selected for the 14 bit counter so the 14 MSB
bit address bits gets valid on the address bus, at the same time the
five bit mux.

will be selected for the five bit counter which will be used as the 5
LSB bits for the Adrress bus to compelete 19 bit address. After
getting the 14 bit

data out from the formed address, the 14bit mux. will be selected for
the 14 bit data bus and the retrived data from the previous address
will appear on the

14 bit MSB address bus lines and at the same time the 5bit mux. will
be selected for the other 5-bit counter inorder to complete the 19-bit
address inorder

to get the final 14 bit data. The 5 bit counter number will appear at
the LSB five bits of the address lines. These two numbers will be
concatenated too.
Off course, the first retrieved data is providing the base address for
the LUT table values and I am not adding any number to the base
address instead I am

concatenating the five bit number to it.
And I can do it because those numbers are 32 and 64 which are six and
seven bit number and they will always appear as the 14 bit MSB bits so
the five LSB

bits are always avaiable for concatenation.

sO, we have pointers in one section of the memroy and have data in
other section of the memory. So the FPGA gets its direction from the
pointer data that

which data value it needs to send out.

I am also attaching my code with the message. My questions are as
follows

1. I am not seeing the right number at the ouput? for example if the
number in the memory is 32 (00000000100000) then at
the output, I am seeing (00001100110011) or sometimes other different
number ?

2. Do I need a latch to store the data into the FPGA before its gets
to address bus?

3. If I need a latch then how it will be implemented?

4. The way I am reading the SRAM, Is it the right way?

Thanks
Regards
john

----Main Sequential Machine ( main program)--------


Library IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
------------------------------------------------------
Entity Read is
port (
Data_Bus : inout unsigned (13 downto 0);
Address_bus : inout unsigned (18 downto 0 );
Read_write: out std_logic;
Output_Enable : out std_logic;


DPR_CLK : in std_logic;


CE0: out std_logic;
CE1 : out std_logic;
LBL : out std_logic;
UBL : out std_logic;
input_signal : in std_logic;
ZZL: out std_logic:='0'; -- To keep the DPR awake!!!
SEML: out std_logic:='1';
OPTL : OUT std_logic;
output_signal : out std_logic;
Latch : out std_logic;
Data_out_bus : out unsigned (18 downto 0);
Request: out std_logic;
CPLD_READY : in std_logic;
OE1: in std_logic

);
End Read;

Architecture DPR_ARCH of Read IS

----------14-bit Counter-----------
Component counter
Port (
Qout : out unsigned (13 downto 0);
CLK : in std_logic;
P : in std_logic;
count_equal: out std_logic;
Reset_c: in std_logic
);
End Component;

---------Counter B (5-bit Channel counter)--------
Component counter_b
Port (
Qout_b : out unsigned (4 downto 0 ); -- 19 bit address bus output
CLK_b : in std_logic; -- Clock for the counter
Load_b : out std_logic; -- Load the intial count
CLRN_b : in std_logic; -- Reset the counter in the beginning
P_b : in std_logic; -- Increment the count
count_equal_b: out std_logic;
Reset_b: in std_logic
);
End Component;

--------Counter C ( 5- bit Sample counter)------
Component counter_c
Port (
Qout_c : out unsigned (9 downto 5 ); -- 19 bit address bus output
CLK_c : in std_logic; -- Clock for the counter
CLRN_c : in std_logic; -- Reset the counter in the beginning
P_c : in std_logic; -- Increment the count
count_equal_c: out std_logic;
Reset: in std_logic
);
End Component;

---------------5-bit Multiplexer---------
Component MUX
Port (
counter_b_datain: in unsigned( 4 downto 0);
counter_c_datain: in unsigned( 4 downto 0);
Select_line: in std_logic;
Data_output : inout unsigned ( 4 downto 0)
);
End Component;

---------------14 bit Multiplexer---------------
Component multiplexer is
Port (
Sel_line : in std_logic;
data_in_counter : in unsigned ( 13 downto 0);
data_in_data_bus : in unsigned ( 13 downto 0);
data_out_mux : out unsigned ( 13 downto 0)
);
End Component;

----------------------Signals for counter A----------------
Signal counter_A_data : unsigned (13 downto 0);

----------------------Signals for counter B----------------
Signal clearB :std_logic;
Signal incrementB : std_logic;
Signal equalsignalB : std_logic;
Signal LoadB: std_logic;
Signal DataoutB : unsigned ( 4 downto 0);
Signal DatainB: unsigned ( 4 downto 0);
Signal Reset_counter_b: std_logic;
----------------------Signals for counter C----------------
Signal clearc :std_logic;
Signal incrementc : std_logic;
Signal equalsignalc : std_logic;
Signal Loadc: std_logic;
Signal Dataoutc : unsigned ( 4 downto 0);
Signal Datainc: unsigned ( 4 downto 0);
Signal Reset_counter_C : std_logic;
Signal incrementc_2 : std_logic;

---------------Signals for the Multiplexer----------------
Signal countb_mux_datain : unsigned (4 downto 0);
Signal countc_mux_datain : unsigned ( 4 downto 0);
Signal mux_select : std_logic;
Signal mux_data_out : unsigned ( 4 downto 0);
Signal sel_output : std_logic;

----------------State "E" Decalarations-------------------
signal State : unsigned(2 downto 0);
signal nextstate : unsigned(2 downto 0);

constant E0 : unsigned(2 downto 0) := "000";
constant E1 : unsigned(2 downto 0) := "001";
constant E2 : unsigned(2 downto 0) := "010";
constant E3 : unsigned(2 downto 0) := "011";
constant E4 : unsigned(2 downto 0) := "100";
constant E5 : unsigned(2 downto 0) := "101";
constant E6 : unsigned(2 downto 0) := "110";

Signal SM_DIR : std_logic;

----------------State "G" decalarations------------------
Signal State_G : unsigned(7 downto 0);
signal nextstate_G : unsigned(7 downto 0);
constant G0 : unsigned(7 downto 0) := "00000000";
Signal SM_DIR_G :std_logic:='1';

---------------State "F" decalarations---------------------
Signal State_F : unsigned(1 downto 0);
signal nextstate_F : unsigned(1 downto 0);
constant F0 : unsigned(1 downto 0) := "00";
constant F1 : unsigned(1 downto 0) := "01";
Signal SM_DIR_F : std_logic:='1';

--Signals for 19-bit counter
Signal equalsignalA : std_logic;
Signal clear :std_logic;
Signal inc: std_logic;
Signal eq_signal : std_logic:='0';
Signal Load_A: std_logic;
Signal Load_B : std_logic;
Signal Reset_A : std_logic:='1';
Signal counter_clock : std_logic;
Signal Data_in : unsigned ( 13 downto 0);

-----------Signals for the 14- bit multiplexer------------
Signal sel_14bit_mux : std_logic;

--------------------Clock signals for the counter-B and counter-C-----
Signal counterb_clock : std_logic;
Signal counterc_clock : std_logic:='1';

--------------------------------------------------------------------------------
Begin
Latch<= not CPLD_READY ;
Data_out_bus(18 downto 14)<=countb_mux_datain;
---------------------------------------------------------------------------------

C0: counter port map (counter_A_data, DPR_CLK,inc,eq_signal,Reset_A);
CB: counter_b port map (countb_mux_datain, DPR_CLK, LoadB, clearB,
incrementB, equalsignalB, Reset_counter_b);
CC: counter_c port map
(countc_mux_datain,equalsignalB,Loadc,incrementc,equalsignalc,
Reset_counter_C);
M: MUX port map (countb_mux_datain,countc_mux_datain, LoadB
,Address_bus(4 downto 0));
M14: multiplexer port map (sel_14bit_mux,counter_A_data,Data_Bus,
Address_bus(18 downto 5));
CF: P2S_COUNTER port map (P2S_CLK,P2S_INC,P2S_compare,P2S_Reset);
-----------------------------------------------------------------------------------

Process (State,nextstate,SM_DIR)
Begin

Case State is

When E1=
Reset_A<='0';
output_signal <='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='1';
mux_select <='0';
incrementB<='1';
LBL <='1';
UBL <='1';
CE0 <='1';
CE1 <='0';
Read_write <='1';
Output_Enable<='0';
Data_Bus<="ZZZZZZZZZZZZZZ";

If (SM_DIR='1') Then
nextstate<=E2;
End If;

-------------------------------------
When E2=
-- Address ( Frame counter ) gets valid!
-- DPR will drive the Data Bus and data will get valid
-- on the data bus!
Reset_A<='0';
output_signal <='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='1';
mux_select <='0';
incrementB<='0';
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Read_write <='1';
Output_Enable<='0';

If (SM_DIR = '1') then
nextstate<=E3;
End If;
--------------------------------------------
When E3 =
-- Data got valid and routed to the address bus via multiplexer!

Reset_A<='0';
output_signal <='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='0'; --Data gets valid on Address bus
mux_select <='0';
incrementB<='0';
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Output_Enable<='0';
Read_write <='1';



If (SM_DIR = '1') then
nextstate<=E4;
End if;

When E4=
--Retrived Data from last state is getting valid in this state!!
Reset_A<='0';
sel_14bit_mux <='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
mux_select <='1';
incrementB<='0';
output_signal <='0';
UBL <='1';
LBL <='1';
CE0 <='1';
CE1 <='0';
Output_Enable<='0';
Read_write <='1';
Data_Bus<="ZZZZZZZZZZZZZZ";

If (SM_DIR = '1') then
nextstate<=E5;
End if;

When E5=
-- Final set of data is retrived.........

mux_select <='1';
Reset_A<='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='0';
incrementB<='0';
output_signal <='0';
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Output_Enable<='0';
Read_write <='1';
--Data_out_bus(13 downto 0) <= Address_bus(13 downto 0);


--Data_out_bus(18 downto 14)<=Address_bus(18 downto 14);
If (SM_DIR = '1') then
nextstate<=E6;
End if;

When E6=
-- Waitng for the CPLD_Ready signal to out put 19 bits!!!

If (CPLD_READY ='1') Then

mux_select <='1';
Reset_A<='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='0';
incrementB<='0';
output_signal <='0';
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Output_Enable<='0';
Read_write <='1';
--Data_out_bus(13 downto 0) <= "01010101010101";


--Data_out_bus(18 downto 14) <= "10101";
Data_out_bus(13 downto 0) <= Address_bus(13 downto 0);


If (SM_DIR = '1') then
nextstate<=E1;
End If;
Else

mux_select <='1';
Reset_A<='0';
Reset_counter_b<='0';
Reset_counter_C<='0';
sel_14bit_mux <='0';
incrementB<='0';
output_signal <='0';
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Output_Enable<='0';
Read_write <='1';
If (SM_DIR = '1') then
nextstate<=E6;
End If;
End If;



When others =
nextstate <= E1;

End Case;
End Process;

----------------------------------------
Process (DPR_CLK)
Begin
If (DPR_CLK'event And DPR_CLK='1') Then

State <= nextstate;
SM_DIR <= OE1;
End If;
End Process;

--------------Counter'C' Process----------------
PROCESS(equalsignalB)
Begin
If ( equalsignalB'event AND equalsignalB='0') then

State_G <= nextstate_G;
SM_DIR_G <= '1';
End If;
End Process;

---------Working area for the Counter C ( Sample Counter )----
PROCESS(State_G,nextstate_G,SM_DIR_G)
Begin
Case State_G is
When G0=
If (SM_DIR_G='1') Then
incrementc <= '1';
nextstate_G <= G0;
End If;

When others =
nextstate_G <= G0;
End Case;
End Process;

-----------Counter 'A' 14 bit counter process---

Process(equalsignalc)
Begin
If (equalsignalc'event AND equalsignalc='0') then

State_F <= nextstate_F;
SM_DIR_F <= '1';

End If;
End Process;

------------Working area for the counterA-----
PROCESS(State_F,nextstate_F,SM_DIR_F)
Begin
Case State_F is

When F0=
If (SM_DIR_F='1') Then
inc <= '1';
nextstate_F <= F0;
End If;
When others =
nextstate_F <= F0;

End Case;
End process;
------------------------------------------

End DPR_ARCH;

---------------------14 -bit counter (Frame
counter)-------------------

Library IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

Entity counter is
Port (
-- temp : out unsigned ( 3 downto 0);
Qout : out unsigned (13 downto 0);--:="11111111111111"; -- 19 bit
address bus output
--Din :eek:ut unsigned (13 downto 0); -- 19 bit address bus input
CLK : in std_logic; -- Clock for the counter
P : in std_logic; -- Increment the count
count_equal: out std_logic;
Reset_c: in std_logic


);
End counter;

Architecture count_arch of counter is

Signal Q : unsigned (13 downto 0);
Signal D : unsigned (13 downto 0):="00000000000000";

Begin
--count_equal<=Q(1);

Process(Clk, Reset_c)
Begin
If (Reset_c = '1') then
-- count_equal <='0';
Q(13 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0' );
Qout<=Q;


Elsif (Clk='1' and Clk'event) then

If (P = '0') then
Q <= Q + 1;
Qout<=Q;
--count_equal <='0';
If(Q=D) Then
-- count_equal<='1';
Q(13 downto 0) <= ( '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0');
Qout<=Q;

End If;
End If;
--End If;
End if;
End process;
End count_arch ;

------------------14 bit Multiplexer----------------

Library IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

Entity multiplexer is

Port (
--its_clk : in std_logic;
Sel_line : in std_logic;
data_in_counter : in unsigned ( 13 downto 0);
data_in_data_bus : in unsigned ( 13 downto 0);
data_out_mux : out unsigned ( 13 downto 0)

);
End multiplexer;

Architecture muxq of multiplexer is
Begi
Process (Sel_line)
Begin
Case Sel_line is

When '1'=
data_out_mux <= data_in_counter;

When '0'=

data_out_mux <=data_in_data_bus;


When others =
data_out_mux <="ZZZZZZZZZZZZZZ";
End case;
End process;

End muxq;

-----------5 bit counter------------------

Library IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

Entity counter_b is
Port (
Qout_b : out unsigned (4 downto 0 ); -- 19 bit address bus output
--Din_b : in unsigned (4 downto 0); -- 19 bit address bus input
CLK_b : in std_logic; -- Clock for the counter
Load_b : out std_logic; -- Load the intial count
CLRN_b : in std_logic; -- Reset the counter in the beginning
P_b : in std_logic; -- Increment the count
count_equal_b: out std_logic;
Reset_b: in std_logic
);
End counter_b;
Architecture count_arch_b of counter_b is

Signal get_equal_b: std_logic;
Signal Q_b : unsigned (4 downto 0);
Signal D_b : unsigned ( 4 downto 0):="00011";

Begin
count_equal_b<=Q_b(4);
--Load_b <= Q_b(4);
Process(CLK_b,Reset_b)
Begin


If ( Reset_b='1') Then
Q_b <= ('0', '0', '0', '0', '0');
Qout_b <= Q_b;
Load_b<='0';

Else If (CLK_b='1' and CLK_b'event) then

If (P_b='1') Then
Q_b<=Q_b +1;
Qout_b<= Q_b;
Load_b<='0';

If (Q_b= D_b) Then
Load_b<='1';
Q_b <= ('0', '0', '0', '0', '0');
Qout_b<= Q_b;
End If;

End If;
End if;
End If;
End process;
End count_arch_b ;

-------------5 bit multiplexer--------------
Library IEEE;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

Entity MUX is
Port (
counter_b_datain: in unsigned( 9 downto 5);
counter_c_datain: in unsigned( 9 downto 5);
Select_line: in std_logic;
Data_output : out unsigned ( 9 downto 5)
);
End MUX;

Architecture behav of MUX is

Begin
Process(Select_line)
Begin
Case Select_line is
When '1'=
Data_output <= counter_c_datain;

When '0'=
Data_output <= counter_b_datain;

When others=
Data_output <= "00000";
End Case;
End process;
End behav;
-----X--------------X-------------------X---------------------------X-----------------
--

Rick "rickman" Collins

rick.collins@XYarius.com
Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
Consider running a simulation to verify that
the descriptions are equivalent.

-- Mike Treseler
 
The simplest example is connecting
an overflowing counter to the ram address bus
and using some less significant count bits
for a ram read enable.

-- Mike Treseler
 
john wrote:
Hello,
I did not understand which document you are reffering! would you
please clear your point...

Thanks
Regards
jim

rickman <spamgoeshere4@yahoo.com> wrote in message
news:<41827DD2.57FB95B0@yahoo.com>...
thomas wrote:

you can also write it like this

http://toolbox.xilinx.com/docsan/xilinx4/data/docs/sim/vtex9.html

I noticed that this doc puts the FSM case statement into a clocked
process. This will work fine if you don't mind your output signals
being clocked (and therefor delayed). Otherwise it can be easier to use
a non-clocked process for the FSM case statement. Then you can define
outputs that depend on the current state and optionally the inputs
(Mealy vs. Moore). Of course the downside is that a non-clocked process
requires you to specify the *entire* sensitivity list!
This took me awhile to find what you were unclear about. I see now that
the example uses a non-clocked process for the next state and output
specifications. The style of formatting did not make it clear where one
process began and the other left off. I use more white space in such
cases and I did not see the start of the combinatorial process.

--

Rick "rickman" Collins

rick.collins@XYarius.com
Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
Sorry , if i sound rude, but this is just another posting where you
have cut and paste the entire Project details and asking for
solutions.

If I am not wrong this is probably another "indian female" posting it
who has taken this Computer Architecture course thinking it mite bost
her GPA but now struggling with it...

PLease do not post ur homeworks,

Thanx

kiranmandava@gmail.com (sirisha) wrote in message news:<a5da77d2.0411011954.5e9fe24d@posting.google.com>...
Arithmetic operations are among the most basic instructions in
microprocessors and many other ASICs. From SPECfp2000 benchmark, about
15% of the floating-point ALU operations are additions and about 10%
are subtractions. The most time consuming arithmetic operation is the
floating-point division, then comes to the multiplication and then the
addition/subtraction. The speed of those arithmetic operations
directly links to the overall performance of the ALU units and so the
computers. Since floating-point addition/subtraction units are built
on top of integer addition/subtraction units, performance of integer
addition/subtraction units have direct link to performance of
floating-point units.

In this class project, we design 2 32-bit addition/subtraction units,
one uses straight simple ripple-carry algorithm and the other uses
carry-looked-ahead algorithm. Our study will basically explore the
correlations between areas, speeds, algorithms and will at least cover
the information as listed below. All analyses will be performed based
on both theory and measurements and explanation will be provided for
discrepancies between the twos.
ƒ 1)Correlation of areas and speeds for both algorithms will be
determined
2)The two designs will be optimized for areas and analysis on speeds
will be performed
3)The two designs will be optimized for speeds and analysis on areas
will be performed
4)Costs and speeds of a 32-bit floating-point unit if the unit is
built based on one addition/subtraction algorithm versus the other
will be relatively evaluated

This project start with verilog code. I am unable to start the
code.I need help from group.

Thanks
sirisha.
 
If you intend a combinational process, take this out:

--If (reset='1')then
--c_alu<="0000000000000000";
--end if ;

If you intend a synchronous process, add a clock:

If (reset='1') then
c_alu<="0000000000000000";
elsif rising_edge (clk) then
case sel_alu is
-- etc etc
end if;

-- Mike Treseler
 
John,
I go back to my original statement:
Run your simulation longer.

You need to run for 2**19 clocks where P = 1.
If P is 1 every other clock, that means you need
to run for a little more than 1 million clocks.

I ran this and it seems to work fine.
It seems that perhaps you don't have any debugging.

Cheers,
Jim
 
Hello,
Thank u ver much for ur reply! I meant to ask you that the complier is
giving me the message that it is ignoring the intialization of the
signal Flag1. I do not know why is it doing it?
Secondly, my question is that the sequential machine in the second
process having "state" equal to E0,E1.E2 is loosing its direction. And
I am trying to find out the answer that is it because of the Flag1
because thats the only signal common bewtween rwo processes.
My third question is that is it the right way to implement it... If I
remove the USB process then Read Write control signals for the memory
works ok but asa I insert the USB process I loose the direction of the
machine...
Thanks
john
rickman <spamgoeshere4@yahoo.com> wrote in message news:<418BB7D1.2FE89987@yahoo.com>...
john wrote:

Hello,

I am trying to interface a USB receiver chip with the FPGA. The USB
chip can only allow unidirection
communications. it just outputs eight bit of data at 12 MHz at each
rising edge of the USB clock in brust
mode. The scheme I used is simple but my State machine is getting lost
and screwing up the count of the counter. some times It works
sometimes it does not work!
I am using the counter to generate addressess for the Dual port RAM.
My VHDL comlplier also ignoring the intialization
of the signal Flag1 and I do not know why? Please Advice!

...snip...

Signal USB_port : unsigned ( 7 downto 0);
Signal Flag1 : std_logic:='0';

Begin

Data_Bus<="00000000000000";
C0: counter port map (Address_bus,
Data_in,DPR_CLK,inc,eq_signal,Reset_A);

Process(State1,nextstate1)
Begin

Case State1 is

When F0 =
Flag1 <='0';
nextstate1 <= F1;

When F1 =
Flag1 <='1';
nextstate1<=F0;

When others =

Null;

End Case;
End Process;

I am not sure how you can tell that Flag1 initialization is being
ignored. Flag1 is assigned a value in a combinatorial process. At
least I assume that is what you intended. In reality you have inferred
a level sensitive latch. You should also be getting warnings about your
sensitivity list in this process. Nextstate1 should not be in it while
F1 and F0 *should* be in it.

If Flag1 is intended to be combinatorial, then you need to define a
value for Flag1 for the "others" condition. Regardless, if it is
combinatorial, it will *always* be assigned a value based on the inputs
to its assignments and the initial value will be ignored. Initial
values are only useful on signals assigned values in clocked processes.


--

Rick "rickman" Collins

rick.collins@XYarius.com
Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
John,
Run your simulation longer. What is Q when count_equal = 1?
Perhaps you want to check with your shorter simulations.

My read of the code says that Count_Equal = 1 when Q = 0.
Going further it looks like Q will be 0 for two clocks.
You have some debugging to do.

Hints:
* Signals do not get updated immediately when they are
assigned - they get their value a simulation cycle
(delta cycle) later. This is the why behind your
current behavior.
* All signal assignments in a clocked process create
registers, hence, count_equal, has a register on it.
If you want the register there (often a good thing),
then you need to adjust your end detect value.

Question: Is Count_Equal allowed to be 1 when P is not 1?

Code/hardware improvement notes:
* If you are counting 2**n values, you can let the counter
roll-over on its own, rather than specify it in your code.
* Use "elsif" rather than "else if" and you can skip one
the "end if;"

* Rather than:
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');

You could write:
Q <= (others => '0') ;
-- or --
Q <= "000000000000000000";
-- or --
Q <= to_unsigned(0,19) ;

If your text book is encouraging you to code like your wrote
above, get J. Bhasker's "A VHDL Primer".


Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:Jim@SynthWorks.com
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Hello,

My 19 bit up counter is working fine but its not toggling
the "count_equal" signal. Its just keeping its value to '0'.
The comparator is not working for 19 bits but it does work for
less than 19 bits.. I am using the comparator to know that count is done!
Please advice... I am also attaching my code...

Thanks
Regards
john


Entity counter is
Port (
Qout : out unsigned (18 downto 0); -- 19 bit address bus output
Din :eek:ut unsigned (18 downto 0); -- 19 bit address bus input
DPR_CLK : in std_logic; -- Clock for the counter
P : in std_logic; -- Increment the count
count_equal: out std_logic;
Reset_c: in std_logic

);
End counter;
-------------------------------------------------------------
Architecture count_arch of counter is

Signal Q : unsigned (18 downto 0);
Signal D : unsigned ( 18 downto 0):="1111111111111111111";
Begin
Qout<=Q;

process(DPR_Clk,Reset_c)
Begin
If (Reset_c = '1') then
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');

count_equal <='0';

Else if (DPR_Clk='1' and DPR_Clk'event) then

If (P = '1') then
Q <= Q + 1;

count_equal <='0';

If(Q = D) Then

count_equal<='1';
Q(18 downto 0) <= ('0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0');
End if;
End if;
End If;
End If;
End process;
End count_arch ;
 
suntthekid wrote:
Hello,
I have a problem about set up inout port when i simulate vhdl code It
is not work
so i want to know how to write vhdl code ( set pin to inout and
it is work) also i try to use tristate but It is not work too. maybe i
miss something in the code and i don't know. help me please
You might also try posting this to comp.lang.vhdl. What the heck, I'll
do it for you...

--

Rick "rickman" Collins

rick.collins@XYarius.com
Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
suntthekid wrote:

I have a problem about set up inout port when i simulate vhdl code It
is not work
Here's an example:

http://groups.google.com/groups?q=vhdl+oe_demo+op_t

-- Mike Treseler
 
Marcus wrote:
I am new to VHDL and already have a problem. I get a error message and
it dont have an idea what I am doing wrong.
Everybody shorts process outputs together the first time out.
You are driving the "counter" port from more than one process.
Merge the reset clause into your second process, then delete
the first process.

-- Mike Treseler
 
Roger Dahl wrote:

Instead, what happens is that while the state machine
is in the second state, the signal keeps
inverting as quickly as the chip can manage.
I expect that you are toggling back and forth
from a to b to a etc.

Your code specifies that

a: d_ctl gets '0'; go to b
b: d_ctl gets inverted to '1'; go to a

and I expect that is exactly what is happening.
Next time consider running a simulation to
debug your code.

-- Mike Treseler
 
"mike_treseler" <tres@fl_ke_networks.com> wrote in message

I expect that you are toggling back and forth
from a to b to a etc.

Your code specifies that

a: d_ctl gets '0'; go to b
b: d_ctl gets inverted to '1'; go to a

and I expect that is exactly what is happening.
Next time consider running a simulation to
debug your code.
Thank you for your reply, Mike.

Actually, the frequency that is output when the state machine is in
the second state is much higher than the clock frequency. It displays
only as a voltage of around 0.1V on my 20MHz oscilloscope. When the
state machine is in the first state, I get GND on the output.

The result I see is also consistent with the RTL schematic, but to me,
the RTL schematic is not consistent with my code.

Finally, the VHDL code seems to work when I simulate it in ModelSim.

Thanks again,

Roger
 
The state machine has two states. The first state sets a signal to 0,
and the second state inverts the signal. From everything I've read
about state machines and processes, the signal should turn to 1 when
the state machine goes to the second state and stay at 1 until the
state machine goes back to the first state. Instead, what happens is
that while the state machine is in the second state, the signal keeps
inverting as quickly as the chip can manage.


Thank you for any help!

Roger Dahl

--

library ieee;
use ieee.std_logic_1164.all;

entity sigtest is
port (
mclk : in std_logic;
d: out std_logic
);
end sigtest;

architecture behavioral of sigtest is

type state is (
write_a,
write_b
);

signal d_ctl : std_logic := '0';

signal cur_st : state := write_a;
signal next_st : state := write_b;

begin

d <= d_ctl;

process (mclk)
begin
if rising_edge(mclk) then
cur_st <= next_st;
end if;
end process;

process (cur_st)
begin
case cur_st is
when write_a =
d_ctl <= '0';
next_st <= write_b;

when write_b =
d_ctl <= not d_ctl;
next_st <= write_a;
end case;
end process;

end behavioral;
The behaviour you observe is correct as per hardware but wont show in
simulation because the process sensitivity list is for simulator
only(it would have shown if you had as required included the d_ctl in
the sensitivity list) , the hardware is not dictated by it, so for all
practical purposes the hardware comb logic triggers everytime the
d_ctl changes which is nothing but a not gate fed to itself. So to
accurately model your requirement you have to specifically state that
d_ctl <= '1' in the write_b state. but you present assignment is
modelling a clock.
 
Hi John,
Its difficult to say just by looking at the code whether the
write/read will be successful to the memory block. If I may suggest,
have you tried simulating with its verilog or vhdl models.
 
Hi,

you make the assignment
nextstate_A <= A1;

Do you have a clocked process you did not show to us?

Rgds
André


conphiloso@hotmail.com (john) wrote in message news:<73aa8725.0411160915.7ebab2a9@posting.google.com>...
Hello,



I am trying to interface a Dual Port RAM (SRAM) with a CPLD. The
memory part number is

IDT 70T633/1S. Now, I am generating the Read /Write cycles for the
memory but i am unable to

see the correct data!

My question is that I am not seeing the data because Am I not
holding the data long enough inside

the CPLD or some other VHDL reason...... Please Advice!

I reduced the code to just write one memory location and reading the
same memory location..


-- Reading Program

Process ( State_A )

Begin
Case State_A is

When A0=>

LBL <='1';
UBL <='1';
CE0 <='1';
CE1 <='0';
Read_write <='1';
Output_Enable <='1';
Data_bus <="ZZZZZZZZZZZZZZ";
Address_bus <="0000000000000000111";

nextstate_A <= A1;


When A1=>
LBL <='0';
UBL <='0';
CE0 <='0';
CE1 <='1';
Read_write <='1';
Output_Enable <='0';
Address_bus <="0000000000000000111";

nextstate_A <= A0



When others =

nextstate_A <= A0;

End Case;

End Process;

------------------------------------------------------------------------------------------------------------
-- Writing Program

Process (State2)
Begin

Case State2 is

When G0=

UBL <='1';
LBL <='1';
CE0 <='1';
CE1 <='0';
Output_Enable <='1';
Read_write <='1';
Data_Bus <= "01010101010101";
Address_bus <="0000000000000000111";



nextstate2 <=G1;

When G1=>

Data_Bus <= "01010101010101";
Address_bus <="0000000000000000111";
UBL <='1';
LBL <='1';
CE0 <='1';
CE1 <='0';
Output_Enable <='1';
Read_write <='1';

nextstate2 <=G2;

When G2=>

Address_bus <="0000000000000000111";
Data_Bus <= "01010101010101";
UBL <='0';
LBL <='0';
CE0 <='0';
CE1 <='1';
Output_Enable <='1';
Read_write <='0';

nextstate2 <=G1;

When others =

nextstate2 <=G0;

End case;
End Process;


Regards
john
 

Welcome to EDABoard.com

Sponsor

Back
Top