Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
It is a classic example:
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 architecture example of reg4 is begin storage : process is variable v0, v1, v2, v3 : bit; begin wait until clk = '1'; if en = '1' then v0 := d0; v1 := d1; v2 := d2; v3 := d3; end if; q0 <= v0 after 5 ns; q1 <= v1 after 5 ns; q2 <= v2 after 5 ns; q3 <= v3 after 5 ns; end process storage; end architecture example ;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 entity reg8 is port ( d0, d1, d2, d3, d4, d5, d6, d7, en, clk : in bit; q0, q1, q2, q3, q4, q5, q6, q7 : out bit ); end entity reg8 ; architecture example of reg8 is begin storage : process is variable v0, v1, v2, v3, v4, v5, v6, v7 : bit; begin wait until clk = '1'; if en = '1' then v0 := d0; v1 := d1; v2 := d2; v3 := d3; v4 := d4; v5 := d5; v6 := d6; v7 := d7; end if; q0 <= v0 after 5 ns; q1 <= v1 after 5 ns; q2 <= v2 after 5 ns; q3 <= v3 after 5 ns; q4 <= v4 after 5 ns; q5 <= v5 after 5 ns; q6 <= v6 after 5 ns; q7 <= v7 after 5 ns; end process storage; end architecture example ;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 process(clk) begin if rising_edge(clk) then if clock_enable = '1' then data_out <= data_in; end if; end if; end process;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 library ieee; use ieee.std_logic_1164.all; entity octal_dffe is port ( q : out std_logic_vector (7 downto 0); d : in std_logic_vector (7 downto 0); clk : in std_logic ); end entity octal_dffe; architecture example of octal_dffe is begin dffe : process (clk) begin if rising_edge (clk) then if (en = '1') then q <= d; end if; end if; end process dffe; end architecture example;
This was the reason why I answered with what would be done by real world engineers. Along with my comment about not hiring anyone who would write something like the code in #3 and #4.It is obvious that this is a school homework, so I would not normally answer, but I think the previous answers are confusing for a beginner.
Maybe the school wants you to design a single bit d-type flip flop and then instantiate it 8 times.
That is not how we do it in the real engineering world, but the core function will look like this, regardless of the number of bits:
Unfortunately given the lack of quality in the code snippets "out in the wild" they are likely to continue the trend of antiquated coding styles (the education system also seems to be behind the times based on the plethora of pre-2000 coding styles being used for both VHDL and Verilog.The rest of the code and the test bench is up to you. You will learn nothing if we give you the answer here. Use your VHDL book and Google to collect the information you need.
hello
please I need help in VHDl code Hex d flip flops with clear and testbench as well..... thanks
Then post the code that you've done that still doesn't work.Sorry.... I tried many times, but I could not could you help me please.
http://www.asic-world.com/examples/vhdl/d_ff.html
Yes. I'm completely with ads-ee in this regardI mean HEX D flip flops with clear.... not d-type flip flop register with clock enable not the same.
You should be able to extrapolate how to write a hex D-FF with clear instead of an enable from post #6 or #7. If you can't then you could perform a search on google.