Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
BerkeleyLab
Bedrock
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Bedrock
/
badger
/
packet_categorize.v
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
41 lines (37 loc) · 1.23 KB
master
Breadcrumbs
Bedrock
/
badger
/
packet_categorize.v
Copy path
Top
File metadata and controls
Code
Blame
41 lines (37 loc) · 1.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Reduce number of bits representing the category
// of a Packet Badger Rx packet from 8 to 4.
// Keep the categories here in-sync with badger_stat.py.
// Output is delayed one cycle; clock domain is unchanged.
// 0: not used
// 1: failed CRC
// 2: ARP for us
// 3: not MAC-addressed for us
// 4: packet type is not IP
// 5: other unrecognized
// 6: ICMP
// 7: not used
// 8-15: UDP to a configured port
module packet_categorize(
input clk,
input strobe,
input [7:0] status, // from Badger's scanner.v
output strobe_o,
output [3:0] category
);
reg strobe_r=0;
reg [3:0] category_r;
always @(posedge clk) begin
strobe_r <= strobe;
// 0 not used
if (~status[2]) category_r <= 4'h1; // failed CRC
else if ( status[1:0] == 2'b01) category_r <= 4'h2; // ARP
else if (~status[3]) category_r <= 4'h3; // not MAC-addressed for us
else if (~status[4]) category_r <= 4'h4; // not IP
else if ( status[1:0] == 2'b00) category_r <= 4'h5; // other unrecognized
else if ( status[1:0] == 2'b10) category_r <= 4'h6; // ICMP
// 7 not used
else category_r <= {1'b1, status[7:5]}; // UDP, status[1:0] == 2'b11
end
assign strobe_o = strobe_r;
assign category = category_r;
endmodule
You can’t perform that action at this time.