hello all! ich such mir jetzt ein synchronous 4-Bit UP/DOWN binary counter,aber ich find keinen in der Xilinx lib.Ich arbeite jetzt mit schematic editor und meine aufgabe stellt darin, dass ich eine schaltung eingebe wie ich im Schaltplan hab.wenn es kein 74HC191 gibt soll ich das selbst programmieren und wie soll ich dass machen. Ich danke euch im voraus. MFG safi
in Verilog sieht sowas etwa so aus: module countud16 (reset,ce,updown,clock,q,tc); input clock,reset,updown,ce; output [15:0] q; output tc; reg [15:0] count_tmp; always @(posedge clock or posedge reset) begin if (reset == 1'b1) count_tmp <= 16'b0000000000000000; else if (ce) begin if (updown == 1'b1) count_tmp <= count_tmp + 16'b0000000000000001; else count_tmp <= count_tmp - 16'b0000000000000001; end end assign q[15:0] = count_tmp[15:0]; assign tc = (count_tmp == 16'b1111111111111111); endmodule Das ganze wird als countud.v abgespeichert und im Syboleditor ein Symbol dazu gezeichnet.
@ Nabil Almuam (Firma ABB) (safiwave) >ich such mir jetzt ein synchronous 4-Bit UP/DOWN binary counter,aber >ich find keinen in der Xilinx lib. Kann ich kaum glauben. Such mal genau. Die heissen meist CNTBxx. >und meine aufgabe stellt darin, dass ich eine schaltung eingebe wie ich >im Schaltplan hab.wenn es kein 74HC191 gibt soll ich das selbst >programmieren und wie soll ich dass machen. Man kann VHDL einbinden. Sieht dann so aus.
1 | library IEEE; |
2 | use IEEE.STD_LOGIC_1164.ALL; |
3 | use IEEE.STD_LOGIC_ARITH.ALL; |
4 | use IEEE.STD_LOGIC_UNSIGNED.ALL; |
5 | |
6 | entity cnt_up_down is |
7 | Port ( clk : in std_logic; |
8 | dir : in std_logic; |
9 | en : in std_logic; |
10 | reset : in std_logic; |
11 | cnt : out std_logic_vector(3 downto 0)); |
12 | end cnt_up_down; |
13 | |
14 | architecture Behavioral of cnt_up_down is |
15 | |
16 | signal cnt_int: std_logic_vector(3 downto 0); |
17 | |
18 | begin
|
19 | |
20 | process(clk) |
21 | begin
|
22 | if rising_edge(clk) then |
23 | if reset='1' then |
24 | cnt_int <= "0000"; |
25 | elsif en ='1' then |
26 | if dir='0' then |
27 | cnt_int <= cnt_int +1; |
28 | else
|
29 | cnt_int <= cnt_int -1; |
30 | end if; |
31 | end if; |
32 | end if; |
33 | end process; |
34 | |
35 | cnt <= cnt_int; |
36 | |
37 | end Behavioral; |
MFG Falk
"Up-down" heißt bei Xilinx "bidirektional" Im PDF zur Xilinx-Schematic-Library lib.pdf steht das hier: CC8CLED, CC16CLED Macro: 8-, 16-Bit Loadable Cascadable Bidirectional Binary Counters with Clock Enable and Asynchronous Clear" CB2X1, CB4X1, CB8X1, CB16X1 2-, 4-, 8-, 16-Bit Loadable Cascadable Bidirectional Binary Counters with Clock Enable and Asynchronous Clear CB2X2, CB4X2, CB8X2, CB16X2 2-, 4-, 8-, and 16-Bit Loadable Cascadable Bidirectional Binary Counters with Clock Enable and Synchronous Reset CBD2CLED, CBD4CLED, CBD8CLED, CBD16CLED 2-, 4-, 8-, 16-Bit Loadable Cascadable Bidirectional Dual Edge Triggered Binary Counters with Clock Enable and Asynchronous Clear CBD2X1, CBD4X1, CBD8X1, CBD16X1 2-, 4-, 8-, 16-Bit Loadable Cascadable Bidirectional Dual Edge Triggered Binary Counters with Clock Enable and Asynchronous Clear CBD2X2, CBD4X2, CBD8X2, CBD16X2 2-, 4-, 8-, and 16-Bit Loadable Cascadable Bidirectional Dual Edge Triggered Binary Counters with Clock Enable and Synchronous Reset
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.