- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
11 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These are basic exercises.
Looks like an homework? :-) Spend at least ten minutes looking into an HDL book and we'll see- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The UD counter looks ok.
The MUX uses a command I don't know. --- Quote Start --- assign mux_out = (sel)?SOURCE0_IH:SOURCE1_IH:SOURCE2_IH:SOURCE3_IH: SOURCE4_IH:SOURCE5_IH:SOURCE6_IH:SOURCE7_IH; --- Quote End --- I only use the conditional operator (?) as a ternary operator. Don't know if can be used in this sense. I would use a case statement: --- Quote Start --- reg mux_out; always @(sel,SOURCE0_IH,SOURCE1_IH, etc.) case (sel) 3'b000: mux_out = SOURCE0_IH; 3'b001: mux_out = SOURCE1_IH; ... default: mux_out = 1'b0; endcase --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to define sel as a bit vector. Now it's a single bit.
sel;
Then the mux code should work. It has been a nice idea to extend the conditional operator to multiple alternatives in your previous example. Unfortunately the Verilog standard doesn't know it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sel is an input, not of the reg type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A simple bit signal can only display values 0 and 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cancelled:cry::cry::cry::cool:

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page