Search Results

Search found 7 results on 1 pages for 'montooner'.

Page 1/1 | 1 

  • Modelsim (XE III/Starter 6.4b) not allowing me to define a macro function

    - by montooner
    I'm working on a Xiling FPGA for a course project. Normally we use the lab computers, but I'm trying to install on my own computer. So, I'm trying to include a macro file using line: `include "Const.v" But the following macro function doesn't work. Any ideas why? `ifdef synthesis // if Synplify `define SYNPLIFY `define SYNTHESIS `define MACROSAFE `else // if not Synplify `ifdef MODELSIM `define SIMULATION `define MACROSAFE `else `define XST // synthesis translate_off // if XST then stop compiling `undef XST `define SIMULATION `define MODELSIM // synthesis translate_on // if XST then resume compiling `ifdef XST `define SYNTHESIS `define MACROSAFE `endif `endif `endif //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Section: Log2 Macro // Desc: A macro to take the log base 2 of any number. Useful for // calculating bitwidths. Warning, this actually calculates // log2(x-1), not log2(x). //------------------------------------------------------------------------------ `ifdef MACROSAFE `define log2(x) ((((x) > 1) ? 1 : 0) + \ (((x) > 2) ? 1 : 0) + \ (((x) > 4) ? 1 : 0) + \ (((x) > 8) ? 1 : 0) + \ (((x) > 16) ? 1 : 0) + \ (((x) > 32) ? 1 : 0) + \ (((x) > 64) ? 1 : 0) + \ (((x) > 128) ? 1 : 0) + \ (((x) > 256) ? 1 : 0) + \ (((x) > 512) ? 1 : 0) + \ (((x) > 1024) ? 1 : 0) + \ (((x) > 2048) ? 1 : 0) + \ (((x) > 4096) ? 1 : 0) + \ (((x) > 8192) ? 1 : 0) + \ (((x) > 16384) ? 1 : 0) + \ (((x) > 32768) ? 1 : 0) + \ (((x) > 65536) ? 1 : 0) + \ (((x) > 131072) ? 1 : 0) + \ (((x) > 262144) ? 1 : 0) + \ (((x) > 524288) ? 1 : 0) + \ (((x) > 1048576) ? 1 : 0) + \ (((x) > 2097152) ? 1 : 0) + \ (((x) > 4194304) ? 1 : 0) + \ (((x) > 8388608) ? 1 : 0) + \ (((x) > 16777216) ? 1 : 0) + \ (((x) > 33554432) ? 1 : 0) + \ (((x) > 67108864) ? 1 : 0) + \ (((x) > 134217728) ? 1 : 0) + \ (((x) > 268435456) ? 1 : 0) + \ (((x) > 536870912) ? 1 : 0) + \ (((x) > 1073741824) ? 1 : 0)) `endif

    Read the article

  • Trying to manually recreate a simple generate/scaffolding script

    - by montooner
    I'm trying to understand Rails from the ground up. I want to learn how to manually create basic show-all/show-single/CRUD functionality in the framework. I currently am working on the display-all functionality, but am stopped by an error when I try to request all items in the Products db Here are the steps I've taken so far: script/generate controller Products script/generate model Products rake db:migrate modified products_controller.rb to add: def index() { @products = Product.all} (error: uninitialized constant ProductsController::Product) ideally, dump all orders in the view What's the fix?

    Read the article

  • What is an example of a website/service which _isn't_ REST?

    - by montooner
    So I just started digging into web tech, and I'm stuck on the concept of REST. Could someone clarify REST by giving me an example of what isn't rest? So, as far as I can tell, REST requires the server and client to both be in the same state at the end of every request-response HTTP transfer. Does that sound right? My understanding is that, if a client stores state information locally (which the server does not know about), that service is NOT rest. Thanks in advance.

    Read the article

  • What JS framework offers scroll functionality (+animation) in a div without a scrollbar?

    - by montooner
    All: I want to scroll through a sequence of tumblr/twitter posts as a long sequence of texts. Let's say we have: <div id="mainContent"> _some content_ </div> where the css for mainContent is: #mainContent { padding: 20px 20px; background: #FFF; height:500px; overflow:hidden; } I really like the functionality of Scrollable jQuery, but they require pagination and an array of elements. I'm looking for tips in any of these categories: a js framework I can use to achieve this a solution to paginating the text

    Read the article

  • How do I set up my @product=Product.find(params[:id]) to have a product_url?

    - by montooner
    Trying to recreate { script/generate scaffold }, and I've gotten thru a number of Rails basics. I suspect that I need to configure default product url somewhere. But where do I do this? Setup: Have: def edit { @product=Product.find(params[:id]) } Have edit.html.erb, with an edit form posting to action = :create Have def create { ... }, with the code redirect_to(@product, ...) Getting error: undefined method `product_url' for #< ProductsController:0x56102b0 My def update: def update @product = Product.find(params[:id]) respond_to do |format| if @product.update_attributes(params[:product]) format.html { redirect_to(@product, :notice => 'Product was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @product.errors, :status => :unprocessable_entity } end end end

    Read the article

  • PUT-ing a form to update a row, but I can't find the id. Where is it?

    - by montooner
    How should I be passing in the ID? Error: Couldn't find Product without an ID Form: <% form_for :product, @product, :url => { :action => :update } do |f| %> <%= f.error_messages %> <p> <%= f.label :names %><br /> <%= f.text_field :names %> </p> <p> <%= f.submit 'Update' %> </p> <% end %> Controller (for /products/edit/1 view): def edit @product = Product.find(params[:id]) end Controller (to change the db): def update @product = Product.find(params[:id]) respond_to do |format| if @product.update_attributes(params[:product]) format.html { redirect_to(@product, :notice => 'Product was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @product.errors, :status => :unprocessable_entity } end end end

    Read the article

1