cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
547 Views
Registered: ‎05-02-2019

pulse generation according to given databits

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
entity two_ghz is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
--sclk :inout std_logic;
sdio : out STD_LOGIC;
sen : out STD_LOGIC);
end two_ghz ;
architecture Behavioral of two_ghz is
signal count_data : std_logic_vector(4 downto 0) := (others => '0');
signal count : INTEGER range 0 to 31 := 0;
signal data : std_logic_vector(31 downto 0) := (others => '0');
signal terminate_en : std_logic := '0';
signal en_count : std_logic := '0';
--signal sck : std_logic;
begin
process(clk)
begin
if rst = '1' then
sdio <= '0';
sen <= '0';
--sclk <= '0';
elsif rising_edge(clk) then
if count < 32 then
sdio <= data(31-count);
--sclk<='1' and sclk<='0';
--sclk<=not sclk;
terminate_en <= '0';--newly added

end if;
--sclk<='1' ;
if count = 31 then
terminate_en <= '1';
sen <='0';
else
sen <='1';
end if;
--sclk<='0';
end if;
end process;
process(clk,rst,terminate_en)
begin
if rst ='1' then
count_data <= (others => '0');
en_count <= '0';
elsif rising_edge(clk) then
if terminate_en = '1' then
count_data <= count_data + 1;
else
count_data <= count_data;
end if;
en_count <= '1';
end if;
end process;
process(clk,rst,en_count,terminate_en)
begin
if rst ='1' or terminate_en = '1' then
count <= 0;
elsif rising_edge(clk) then
en_count <= '1';
if en_count = '1' then
count <= count + 1;
else
count <= count;
end if;
end if;
end process;
data <= "00000000000000000000000000000000" when count_data = "00000" else
"00000000000000000000000000000010" when count_data = "00001" else
"00000000000000000000000000000001" when count_data = "00010" else
"00000000000000000001011000101000" when count_data = "00011" else
"00000000000000000110000010100000" when count_data = "00100" else
"00000000000000001110000010010000" when count_data = "00101" else
"00000000000000000010100000011000" when count_data = "00110" else
"00000000000000000000000000000000" when count_data = "00111" else
"00000000000000110000001111001010" when count_data = "01000" else
"00000000000000000000000101001101" when count_data = "01001" else
"00000000110000011011111011111111" when count_data = "01010" else
"00000000000000000011111111111111" when count_data = "01011" else
"00000000000000000010000001000110" when count_data = "01100" else
"00000000000001111100000001100001" when count_data = "01101" else
"00000000000000000000000000000000" when count_data = "01110" else
"00000000000000000000000010000001" when count_data = "01111" else
"00000000000000000000000000101000" when count_data = "10000" else
"00000000000000000000000000000000";
end Behavioral;

pulses has to be generate when the data varies ,the pulses need to be generate even if 0 and 1  bit is in data

 

0 Kudos
8 Replies
Highlighted
Moderator
Moderator
501 Views
Registered: ‎09-15-2016

Re: pulse generation according to given databits

Hi @anuanusha ,

I see the below output for the above mentioned code. Can you please elaborate more on the issue you are facing.

ouput.JPG

Thanks & Regards,
Sravanthi B
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
Visitor
Visitor
478 Views
Registered: ‎05-02-2019

Re: pulse generation according to given databits

tq mam...for u r responce mam...

in the above output ..there is some data is there...in that data we have 32 bits .....

i want to another ouput like...."for that data i want to generate the pulses ".in the given data 1's and 0's are there...if the data is either 0 0r 1 i want to display the pulse for every bit....please support me to generate like that...

0 Kudos
Highlighted
Moderator
Moderator
470 Views
Registered: ‎05-31-2017

Re: pulse generation according to given databits

Hi @anuanusha ,

If you click on the arrow of data bus present in the waveform window as shown in the below snippet, you can be able to see the pulse waves for the individual bits as shown in the below snippet

sim_data.JPG

 

0 Kudos
Highlighted
Visitor
Visitor
457 Views
Registered: ‎05-02-2019

Re: pulse generation according to given databits

tq mam...

but i want to serial form mam...in that ouput it can seens like parallelly  only.....i want to serial out put like.... given below page mam

 

0 Kudos
Highlighted
Moderator
Moderator
445 Views
Registered: ‎05-31-2017

Re: pulse generation according to given databits

Hi @anuanusha ,

If I am not wrong you are willing to see the data just like the SCK signal which is present in the shared spi.docx file. But data is a bus which is a group of bits but not a single bit similar to SDI signal present in the shared spi.docx file. 

0 Kudos
Highlighted
Visitor
Visitor
437 Views
Registered: ‎05-02-2019

Re: pulse generation according to given databits

yes mam...data is a group of bits mam...but i want to anather ouput like sck...is it possible to get like that mam?

0 Kudos
Highlighted
427 Views
Registered: ‎06-21-2017

Re: pulse generation according to given databits

You need to write code to implement a parallel to serial shift register.  Load the register once every 32 SCLK cycles with your DATA signal.  On every SCLK cycle, shift out one bit.

0 Kudos
Highlighted
Visitor
Visitor
417 Views
Registered: ‎05-02-2019

Re: pulse generation according to given databits

tq sir..

i will try to get the output like sclk

0 Kudos