sam93
Junior Member level 1
hi, in part of my project I have to divide a 26 bit binary variable to 19 bit binary constant. would you help me? language is vhdl. thank you in advanced.
it's my code and doesn't work!
it's my code and doesn't work!
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 process (CLK_20M) constant a : std_logic := "1000111101110000000"; --293760 variable counter: std_logic_vector(25 downto 0) ; ;--26 bits 67108863 variable count:std_logic_vector(25 downto 0) ; ;--26 bits variable rps: std_logic_vector(7 downto 0) ; -- 8 bits 255 begin if rising_edge(CLK_20M) then counter:=counter + 1; if (counter > 20000000) then counter := (others => '0'); elsif rising_edge(ENCODER_HALLSENSOR_B) then count := count + 1; end if; end if; rpss := count/a;
Last edited by a moderator: