Search the Community

Showing results for tags 'registers'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 3 results

  1. Hey everyone, I've done the initial design of a register file (16x 32-bit registers, two write ports, four read ports) in VHDL as part of a larger project, but seeing as I am a relative newcomer to HDLs, I was hoping to get some feedback on my design, any errors I may have made, or any improvements I might want to make. Here is the VHDL: -- Register file -- Two write ports, four read ports. -- For performance reasons, this register file does not check for the same -- register being written on both write ports in the same cycle. CPU control -- circuitry is responsible for preventing this condition from happening. library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; use work.cpu1_globals_1.all; use work.func_pkg.all; entity registerFile is port ( clk : in std_logic; rst : in std_logic; writeEnableA : in std_logic; writeEnableB : in std_logic; readSelA, readSelB, readSelC, readSelD, writeSelA, writeSelB : in std_logic_vector(3 downto 0); data_inA, data_inB : in std_logic_vector(DATA_WIDTH - 1 downto 0); data_outA, data_outB, data_outC, data_outD : out std_logic_vector(DATA_WIDTH - 1 downto 0) ); end registerFile; architecture behavioral of registerFile is type regArray is array (0 to 15) of std_logic_vector(DATA_WIDTH - 1 downto 0); signal registers : regArray := (others => (others => '0')); begin data_outA <= registers(to_integer(unsigned(readSelA))); data_outB <= registers(to_integer(unsigned(readSelB))); data_outC <= registers(to_integer(unsigned(readSelC))); data_outD <= registers(to_integer(unsigned(readSelD))); registerFile_main : process(clk) begin if(rising_edge(clk)) then if(rst = '1') then registers <= (others => (others => '0')); else if(writeEnableA = '1') then registers(to_integer(unsigned(writeSelA))) <= data_inA; end if; if(writeEnableB = '1') then registers(to_integer(unsigned(writeSelB))) <= data_inB; end if; end if; end if; end process; end behavioral; This design is intended for use on FPGAs, hence the use of default values for the registers. I appreciate any feedback you might have! Thanks, - Curt
  2. Hello! Recently I bought a PMOD AD5 board to hook it up with my Arduino DUE in order to measure AC Voltage. In terms of libraries, I tried two - the official AD7193 library and the AD Converter one, from GitHub. The AD Converter one seems like it's based on the official DSP library from your wiki, but adapted to Arduino. With that one, I had a few problems, so I went with the other one. For starters, I have my signal connected to AIN3 and GND connected to AIN4 (both on J2). The SPI is properly connected to my DUE, settings are SPI_MODE3 and SPI_CLOCK_DIV32 (initially it was DIV16, but I decided to try 32 as well, unfortunately to no avail). I am powering up everything from the 3.3V pin on the DUE and my signal is 50 Hz sine wave, with a 1.65V reference. I am measuring it with normal differential type, not the pseudo type (even though I tried that). Originally, with the default library, I could measure the 1.65V, but the sine wave isn't there (because of the 50Hz/60Hz rejection filter). Trying out different things with the mode and configuration registers from the AD7193 datasheet, I tried to set it up the following way: Chop Disabled, SYNC4 (and SYNC3 afterwards), FS=1; which from the datasheet it said that the 50Hz and 60Hz rejection would be disabled. I tried a whole lot of things, but I just couldn't get the filter turned off. Reason I am writing this is that I am hoping someone here can help me with my dilema and give me the means of measuring AC Voltage, because the ADC is great. Here are my register values: Mode - 0x080001 Configuration - 0x000208 I got these register values from the AD719X AFM Simulation Software. Running this configuration there, with 5MHz of the SCLK generates the Frequency diagram exactly as I need it. But for some reason, with the Arduino library, that just doesn't want to work. Thank you a lot for reading and I'm hoping someone can help.
  3. I'm playing around with timer interrupts on the DP32 using Arduino and the ChipKIT Core. I was surprised to find out that this involves register manipulation. So I can set up timers using register manipulation in Arduino, but I can't seem to do anything else with register manipulation. For example, here is some code of mine which should set up a PWM signal on pin 13 (OC4) of the DP32 using register manipulation, instead of analogWrite() function. Problem is that it doesn't work and I can't figure out why. This problem is exacerbated by the apparent lack of documentation on any of the register manipulation functions(?) that I use to set my timers up previously. I know they work, but I only found them in a tutorial that doesn't explain where they come from, or much about them at all. So I have the following questions: Am I allowed to do register manipulation for more than just timers? Where can I find more information about how ChipKIT Core uses and defines these things? What am I doing wrong with my code? /******************************** Constants ********************************/ #define T3CON_ENABLE_BIT 0x8000 #define T3CON_PRESCALER_BITS 0x0070 #define T3_SOURCE_INT 0 #define OC4_ENABLE_BIT 0x8000 #define OC4_TIMER_SEL_BIT 0x0008 #define OC4_MODE_BITS 0x0007 #define OC4_MODE_PWM_SET 0x0006 // Prescaler values // Don't change these. Set the prescaler below using these. #define T3_PRESCALE_1_1 0 #define T3_PRESCALE_1_2 1 #define T3_PRESCALE_1_4 2 #define T3_PRESCALE_1_8 3 #define T3_PRESCALE_1_16 4 #define T3_PRESCALE_1_32 5 #define T3_PRESCALE_1_64 6 #define T3_PRESCALE_1_256 7 // Set the prescaler value we want to use #define PRESCALE T3_PRESCALE_1_256 // Current it's set to 1:256 // The DP32 runs at 40 MHz // The uC32 and WF32 run at 80 MHz #define CLOCK_FREQ 40000000 // Right now we're set for the DP32 // Set our target frequency // This is the frequency that our interrupt will run at in Hz #define T3_FREQUENCY 5 void setup() { uint32_t period; uint32_t cycle; uint32_t mask; // Disable everything T3CONCLR = T3CON_ENABLE_BIT; // Turn the timer off OC4CONCLR = OC4_ENABLE_BIT; // Turn OC4 off RPB2R = 0b0101; // Calculate the period we need for our given frequency if (PRESCALE == 7) period = 256; // 1:256 is a special case else period = 1 << PRESCALE; period = period * T3_FREQUENCY; period = CLOCK_FREQ / period; // Set up our timer T3CONCLR = T3CON_PRESCALER_BITS; // Clear the old prescaler mask = PRESCALE << 4; // Shift our new prescaler mask = mask | T3CON; // Mask our prescaler T3CON = mask; // Set the prescaler TMR3 = 0; // Clear the counter PR3 = period; // Set the period // Calculate our cycle cycle = period /2; // We want a 50% duty cycle // Set up our output compare OC4CONSET = OC4_TIMER_SEL_BIT; // Select timer 3 for source OC4CONCLR = OC4_MODE_BITS; // Clear our mode pins OC4CONSET = OC4_MODE_PWM_SET; // Set our mode to PWM w/out fault pin OC4R = cycle; // Set our cycle // Enable everything T3CONSET = T3CON_ENABLE_BIT; // Turn the timer on OC4CONSET = OC4_ENABLE_BIT; // Turn OC4 on } void loop() { }